dke-questions
dke-questions > RE: MATLAB:badsubscript
Mar 1, 2018 11:03 AM | Emilie McKinnon - MUSC
RE: MATLAB:badsubscript
Hi Ryan,
I looks like you have some NaNs in your 4D Nifti. Most often they appear only at the edges of the image so they should not have affect the brain. They tend to be introduced by preprocessing techniques (image conversions, denoising, eddy current corrections,..).
A quick fix would be to change the values from NaN to 0 in matlab.
Something along these lines (or your preferred way of making a 4D nifti) :
nvol=257;
hdr=spm_vol('path_to_image');
image_name=spm_read_vols(hdr);
image_name(isnan(image_name))=0;
for vol=1:nvol
hdr.n(1)=vol;
spm_write_vol(hdr,img(:, :, :, vol));
end;
Best,
Emilie
I looks like you have some NaNs in your 4D Nifti. Most often they appear only at the edges of the image so they should not have affect the brain. They tend to be introduced by preprocessing techniques (image conversions, denoising, eddy current corrections,..).
A quick fix would be to change the values from NaN to 0 in matlab.
Something along these lines (or your preferred way of making a 4D nifti) :
nvol=257;
hdr=spm_vol('path_to_image');
image_name=spm_read_vols(hdr);
image_name(isnan(image_name))=0;
for vol=1:nvol
hdr.n(1)=vol;
spm_write_vol(hdr,img(:, :, :, vol));
end;
Best,
Emilie
Threaded View
Title | Author | Date |
---|---|---|
Ryan Cloyd | Feb 23, 2018 | |
Emilie McKinnon | Feb 28, 2018 | |
Ryan Cloyd | Feb 28, 2018 | |
Ryan Cloyd | Feb 28, 2018 | |
Emilie McKinnon | Feb 28, 2018 | |
Ryan Cloyd | Mar 1, 2018 | |
Emilie McKinnon | Mar 1, 2018 | |
Ryan Cloyd | Mar 2, 2018 | |
Emilie McKinnon | Mar 2, 2018 | |