You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If pet image created by ecat2nii requires rescaling, then ecat2nii.m tries to write scaling info to a .txt file saved to a folder (ecat_save_steps_dir) that is .../PET2BIDS/ecat_testing/steps, which does not exist in current PET2BIDS structure. Seems to me there are at least two straight-forward solutions: 1) write .txt file to .../PET2BIDS/matlab/ecat_testing, which does exist in current PET2BIDS structure, or 2) mkdir(ecat_save_steps_dir) if it does not exist. I am uncertain whether one is preferred for reasons about which I am unaware.
l. 202 - 220 of ecat2nii.m:
% rescale to 16 bits rg = max(img_temp(:))-min(img_temp(:)); if rg ~= 32767 % same as range(img_temp(:)) but no need of stats toolbox MaxImg = max(img_temp(:)); img_temp = img_temp/MaxImg*32767; Sca = MaxImg/32767; MinImg = min(img_temp(:)); if (MinImg<-32768) img_temp = img_temp/MinImg*(-32768); Sca = Sca*MinImg/(-32768); end % save scaling factor to file located at ecat_save_steps_dir/8.5_sca_matlab.txt fid = fopen([ecat_save_steps_dir filesep '8.5_sca_matlab.txt'],'w'); fprintf(fid,'Scaling factor: %10e\n',Sca); x = mh.ecat_calibration_factor * Sca; fprintf(fid,'Scaling factor * ECAT Cal Factor: %10.10f\n',x); fclose(fid); end
To Reproduce
code: ecat2nii(filename{1},metadata);
error: Invalid file identifier. Use fopen to generate a valid file identifier.
Desktop (please complete the following information):
OS: Linux
matlab r2023a
The text was updated successfully, but these errors were encountered:
@bendhouseart I do not remember writing this - did you do that? @fishpm looks like we did that to test stuff as we had some issues -- and IMO that is not something user need to know (Claus does that all the time)
Describe the bug
If pet image created by ecat2nii requires rescaling, then ecat2nii.m tries to write scaling info to a .txt file saved to a folder (ecat_save_steps_dir) that is .../PET2BIDS/ecat_testing/steps, which does not exist in current PET2BIDS structure. Seems to me there are at least two straight-forward solutions: 1) write .txt file to .../PET2BIDS/matlab/ecat_testing, which does exist in current PET2BIDS structure, or 2) mkdir(ecat_save_steps_dir) if it does not exist. I am uncertain whether one is preferred for reasons about which I am unaware.
l. 202 - 220 of ecat2nii.m:
% rescale to 16 bits
rg = max(img_temp(:))-min(img_temp(:));
if rg ~= 32767 % same as range(img_temp(:)) but no need of stats toolbox
MaxImg = max(img_temp(:));
img_temp = img_temp/MaxImg*32767;
Sca = MaxImg/32767;
MinImg = min(img_temp(:));
if (MinImg<-32768)
img_temp = img_temp/MinImg*(-32768);
Sca = Sca*MinImg/(-32768);
end
% save scaling factor to file located at ecat_save_steps_dir/8.5_sca_matlab.txt
fid = fopen([ecat_save_steps_dir filesep '8.5_sca_matlab.txt'],'w');
fprintf(fid,'Scaling factor: %10e\n',Sca);
x = mh.ecat_calibration_factor * Sca;
fprintf(fid,'Scaling factor * ECAT Cal Factor: %10.10f\n',x);
fclose(fid);
end
To Reproduce
code:
ecat2nii(filename{1},metadata);
error: Invalid file identifier. Use fopen to generate a valid file identifier.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: