Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ecat2Nii] Only apply ECAT_CALIBRATION_FACTOR if it has not already b… #268

Merged
merged 6 commits into from
Feb 20, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pypet2bids/pypet2bids/ecat2nii.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ def ecat2nii(ecat_main_header=None,
prompts.append(0)
randoms.append(0)

final_image = img_temp * main_header['ECAT_CALIBRATION_FACTOR']
ecat_cal_units = main_header['CALIBRATION_UNITS'] # Header field designating whether data has already been calibrated
if ecat_cal_units==1: # Calibrate if it hasn't been already
final_image = img_temp * main_header['ECAT_CALIBRATION_FACTOR']
else: # And don't calibrate if CALIBRATION_UNITS is anything else but 1
final_image = img_temp

qoffset_x = -1 * (
((sub_headers[0]['X_DIMENSION'] * sub_headers[0]['X_PIXEL_SIZE'] * 10 / 2) - sub_headers[0][
Expand Down Expand Up @@ -187,7 +191,7 @@ def ecat2nii(ecat_main_header=None,

# TODO img_nii.header['scl_slope'] # this is a NaN array by default but apparently it should be the dose calibration
# factor img_nii.header['scl_inter'] # defaults to NaN array
img_nii.header['scl_slope'] = main_header['ECAT_CALIBRATION_FACTOR']
img_nii.header['scl_slope'] = 0
img_nii.header['scl_inter'] = 0
img_nii.header['slice_end'] = 0
img_nii.header['slice_code'] = 0
Expand Down
Loading