From a349d52c1e03286c3e721c2a49e4d5f9e717f9ec Mon Sep 17 00:00:00 2001 From: CPernet Date: Thu, 15 Feb 2024 15:44:06 +0100 Subject: [PATCH 1/6] add conditional statement ecat validation unchanged --- matlab/ecat2nii.m | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/matlab/ecat2nii.m b/matlab/ecat2nii.m index 2a059eb4..4300249b 100644 --- a/matlab/ecat2nii.m +++ b/matlab/ecat2nii.m @@ -216,7 +216,11 @@ % save raw data if savemat - ecat = img_temp.*(Sca*mh.ecat_calibration_factor); + if mh.calibration_units == 1 % see line 337 + ecat = img_temp.*Sca; + else + ecat = img_temp.*(Sca*mh.ecat_calibration_factor); + end save([filenameout '.ecat.mat'],'ecat','-v7.3'); end @@ -330,7 +334,13 @@ warning('the json file is BIDS invalid') end - img_temp = single(round(img_temp).*(Sca*mh.ecat_calibration_factor)); + if mh.calibration_units == 1 + img_temp = single(round(img_temp).*Sca); % just the 16 bit scaling, img_temp is already dose calibrated + warning('it looks like the source data are already dose calibrated - ecat2nii is thus not scaling the data') + else + img_temp = single(round(img_temp).*(Sca*mh.ecat_calibration_factor)); % scale and dose calibrated + warning('it looks like the source data are not dose calibrated - ecat2nii is thus scaling the data') + end info.Datatype = 'single'; info.BitsPerPixel = 32; info.SpaceUnits = 'Millimeter'; From 96246317aab2d024a83e4693fefec31ee0d5abc1 Mon Sep 17 00:00:00 2001 From: CPernet Date: Thu, 15 Feb 2024 17:07:49 +0100 Subject: [PATCH 2/6] calibration unit inverted --- matlab/ecat2nii.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matlab/ecat2nii.m b/matlab/ecat2nii.m index 4300249b..32cd6228 100644 --- a/matlab/ecat2nii.m +++ b/matlab/ecat2nii.m @@ -334,7 +334,7 @@ warning('the json file is BIDS invalid') end - if mh.calibration_units == 1 + if mh.calibration_units == 0 img_temp = single(round(img_temp).*Sca); % just the 16 bit scaling, img_temp is already dose calibrated warning('it looks like the source data are already dose calibrated - ecat2nii is thus not scaling the data') else From 0e00305f95ace80121aa402eacd3cbf170fe7d1c Mon Sep 17 00:00:00 2001 From: CPernet Date: Thu, 15 Feb 2024 17:11:52 +0100 Subject: [PATCH 3/6] Revert "calibration unit inverted" This reverts commit 96246317aab2d024a83e4693fefec31ee0d5abc1. --- matlab/ecat2nii.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matlab/ecat2nii.m b/matlab/ecat2nii.m index 32cd6228..4300249b 100644 --- a/matlab/ecat2nii.m +++ b/matlab/ecat2nii.m @@ -334,7 +334,7 @@ warning('the json file is BIDS invalid') end - if mh.calibration_units == 0 + if mh.calibration_units == 1 img_temp = single(round(img_temp).*Sca); % just the 16 bit scaling, img_temp is already dose calibrated warning('it looks like the source data are already dose calibrated - ecat2nii is thus not scaling the data') else From af721217e61c4b12ee830666f832bca7a29f90a0 Mon Sep 17 00:00:00 2001 From: CPernet Date: Thu, 15 Feb 2024 17:15:38 +0100 Subject: [PATCH 4/6] Revert "Revert "calibration unit inverted"" This reverts commit 0e00305f95ace80121aa402eacd3cbf170fe7d1c. --- matlab/ecat2nii.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matlab/ecat2nii.m b/matlab/ecat2nii.m index 4300249b..32cd6228 100644 --- a/matlab/ecat2nii.m +++ b/matlab/ecat2nii.m @@ -334,7 +334,7 @@ warning('the json file is BIDS invalid') end - if mh.calibration_units == 1 + if mh.calibration_units == 0 img_temp = single(round(img_temp).*Sca); % just the 16 bit scaling, img_temp is already dose calibrated warning('it looks like the source data are already dose calibrated - ecat2nii is thus not scaling the data') else From 6ddef86748fc05e560c454657285f15cb854dda8 Mon Sep 17 00:00:00 2001 From: CPernet Date: Thu, 15 Feb 2024 17:17:52 +0100 Subject: [PATCH 5/6] with comment --- matlab/ecat2nii.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/matlab/ecat2nii.m b/matlab/ecat2nii.m index 32cd6228..9f8b8846 100644 --- a/matlab/ecat2nii.m +++ b/matlab/ecat2nii.m @@ -334,10 +334,10 @@ warning('the json file is BIDS invalid') end - if mh.calibration_units == 0 + if mh.calibration_units == 1 % calibrated img_temp = single(round(img_temp).*Sca); % just the 16 bit scaling, img_temp is already dose calibrated warning('it looks like the source data are already dose calibrated - ecat2nii is thus not scaling the data') - else + else % uncalibrated img_temp = single(round(img_temp).*(Sca*mh.ecat_calibration_factor)); % scale and dose calibrated warning('it looks like the source data are not dose calibrated - ecat2nii is thus scaling the data') end From 216553594421b105428ccd2817aef019648fed75 Mon Sep 17 00:00:00 2001 From: CPernet Date: Fri, 16 Feb 2024 16:15:06 +0100 Subject: [PATCH 6/6] changing once more that calbration bolean --- matlab/ecat2nii.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/matlab/ecat2nii.m b/matlab/ecat2nii.m index 9f8b8846..c2b9f407 100644 --- a/matlab/ecat2nii.m +++ b/matlab/ecat2nii.m @@ -334,12 +334,12 @@ warning('the json file is BIDS invalid') end - if mh.calibration_units == 1 % calibrated - img_temp = single(round(img_temp).*Sca); % just the 16 bit scaling, img_temp is already dose calibrated - warning('it looks like the source data are already dose calibrated - ecat2nii is thus not scaling the data') - else % uncalibrated + if mh.calibration_units == 1 % do calibrate img_temp = single(round(img_temp).*(Sca*mh.ecat_calibration_factor)); % scale and dose calibrated warning('it looks like the source data are not dose calibrated - ecat2nii is thus scaling the data') + else % do not calibrate + img_temp = single(round(img_temp).*Sca); % just the 16 bit scaling, img_temp is already dose calibrated + warning('it looks like the source data are already dose calibrated - ecat2nii is thus not scaling the data') end info.Datatype = 'single'; info.BitsPerPixel = 32;