help > RE: Edge Plot
Oct 8, 2016  02:10 AM | Mingrui Xia
RE: Edge Plot
Hi, 

There following codes can be used to convert your txt file to nifti file: 

hdr = spm_vol('Reslice_ch2.nii');
vol = spm_read_vols(hdr);
vol_new = zeros(size(vol));
value = load('ThreDeltaLoc.txt');
loc = load('location.txt');
loc = loc';
loc(4,:) = 1;
loc = round(hdr.mat\loc);
ind = sub2ind(hdr.dim,loc(1,:),loc(2,:),loc(3,:));
vol_new(ind) = value;
hdr_new = hdr;
hdr_new.fname = 'ThreDeltaLoc.nii';
hdr_new.dt(1) = 64;
hdr_new.descrip = '';
spm_write_vol(hdr_new,vol_new);

I also attached relevant files. I resliced the nifti file to a 5mm resolution according to your coordinates, you can use different resolution in other cases.

Best,
Mingrui
Attachment: ThreDeltaLoc.zip

Threaded View

TitleAuthorDate
Gyan Raj Koirala Jul 29, 2016
Gyan Raj Koirala Oct 6, 2016
Mingrui Xia Oct 6, 2016
Gyan Raj Koirala Oct 6, 2016
Mingrui Xia Oct 6, 2016
Gyan Raj Koirala Oct 6, 2016
RE: Edge Plot
Mingrui Xia Oct 8, 2016
Gyan Raj Koirala Sep 9, 2016
Mingrui Xia Sep 10, 2016
Gyan Raj Koirala Sep 8, 2016
Gyan Raj Koirala Sep 8, 2016
Gyan Raj Koirala Sep 8, 2016
Mingrui Xia Jul 30, 2016
Gyan Raj Koirala Aug 1, 2016
Gyan Raj Koirala Aug 1, 2016
Mingrui Xia Aug 1, 2016
Gyan Raj Koirala Aug 1, 2016
Mingrui Xia Aug 1, 2016
Gyan Raj Koirala Aug 2, 2016