Rank: 59 based on 627 downloads (last 30 days) and 6 files submitted
photo

Jimmy Shen

E-mail
Company/University
Rotman Research Institute

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Files Posted by Jimmy View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
06 Mar 2012 geotiffwrite Write a 2D or 3D array to a single or multi-band GeoTIFF file Author: Jimmy Shen earth sciences, dem, earth science, gps, gis, image 59 18
  • 5.0
5.0 | 6 ratings
21 Sep 2011 Screenshot Tools for NIfTI and ANALYZE image Load, save, make, reslice, view (and edit) both NIfTI and ANALYZE data on any platform Author: Jimmy Shen analyze, nifti, image, medical, isotropic, niftl 463 102
  • 4.58065
4.6 | 32 ratings
28 Mar 2011 Screenshot Edit plotted data with mouse Edit plotted data by picking any point on the curve and moving the mouse. Author: Jimmy Shen graphics, gui, demo, mouse movement, edit data 14 0
22 Feb 2011 Load BIOPAC ACQ (AcqKnowledge for PC) data Load BIOPAC's *.acq file (AcqKnowledge for Windows data format). Author: Jimmy Shen medical, biopac acqknowledge, acq, eeg, file, data 30 14
  • 4.71429
4.7 | 7 ratings
16 Apr 2009 Screenshot Resampling volume or image with affine matrix Use affine matrix to convert 3D vol or 2D img to orthogonal one with corresponding affine matrix. Author: Jimmy Shen 2d, affine, 3d, image, volume, voxel 51 7
  • 4.5
4.5 | 4 ratings
Comments and Ratings by Jimmy View all
Updated File Comments Rating
30 Apr 2012 Tools for NIfTI and ANALYZE image Load, save, make, reslice, view (and edit) both NIfTI and ANALYZE data on any platform Author: Jimmy Shen

Sure Mark. You need a reference image by the way, so you can see what will happen before and after you apply the transformation matrix. Here's the example:

1. Download "avg152T1_RL_nifti.nii" from NIfTI site. I use it as reference image.

2. View how the reference image looks like: nii=load_nii('avg152T1_RL_nifti.nii');
view_nii(nii);

3. Assume that I have a Transformation Matrix, which will let the reference image turn 30 degree counter-clockwise on XY plane, here will be the matrix: T=[cos(pi/6) -sin(pi/6) 0; sin(pi/6) cos(pi/6) 0; 0 0 1];

4. Get old_xyz from reference image: rl=load_untouch_nii('avg152T1_RL_nifti.nii');
old_xyz=[rl.hdr.hist.srow_x(1:3);rl.hdr.hist.srow_y(1:3);rl.hdr.hist.srow_z(1:3)];

5. Apply your transformation matrix, and save new_xyz into a new image: new_xyz=T*old_xyz; rl.hdr.hist.srow_x(1:3)=new_xyz(1,:); rl.hdr.hist.srow_y(1:3)=new_xyz(2,:); rl.hdr.hist.srow_z(1:3)=new_xyz(3,:); save_untouch_nii(rl, 'rl30.nii'); Now you already have the "rl30.nii", which is a transformed NIfTI image can be used anywhere.

6. In order to view this image using my toolbox, you need to reslice it: reslice_nii('rl30.nii', 'rl30b.nii'); Now, you can load and view the rotated image: rl30b=load_nii('rl30b.nii'); view_nii(rl30b);

Hopefully this answers your questions.

26 Apr 2012 geotiffwrite Write a 2D or 3D array to a single or multi-band GeoTIFF file Author: Jimmy Shen

You need to use MATLAB's geotiffread to read L7 file into matrix, with all attributes. Then find out the index of your sub-region, and assign the sub-region to a new matrix. You can now use the make_option option in my package to select optional fields. However, you need to match the attributes that you read, and select the correct fields by yourself in order to create the optional fields to be used in my geotiffwrite. Since I don't have Mapping toolbox, I am afraid that I cannot provide you with more details.

26 Apr 2012 geotiffwrite Write a 2D or 3D array to a single or multi-band GeoTIFF file Author: Jimmy Shen

My geotiffwrite can only write a rectangular dataset into the file. As long as your sub-region is a rectangular dataset, you should be able to write it into a separate file.

19 Apr 2012 Tools for NIfTI and ANALYZE image Load, save, make, reslice, view (and edit) both NIfTI and ANALYZE data on any platform Author: Jimmy Shen

To reply your first comment: The problem is that you mixed "make_nii" with "_untouch_" version. If you use "make_nii" to get NIfTI structure, it has to be saved using "save_nii".

To reply your second comment: If you know NIfTI structure well, sure you can modify it and then use "save_nii" to save it. You can even save "non-orthogonal" NIfTI structure to the file with "save_nii".

The reason that I interpret the header with "load_nii" and limit it to "orthogonal" transformation is all about convenience, at least for my work.

BTW, if you take the original NIfTI file, and bring it to other software to display (e.g. SPM), they will also reslice it for you.

Thank you very much for your rating!

28 Mar 2012 geotiffwrite Write a 2D or 3D array to a single or multi-band GeoTIFF file Author: Jimmy Shen

MATLAB finally has its own "geotiffwrite" function. So I suggest you use its geotiffread / geotiffwrite pair to load your Antarctica background, and superimpose your ship track data on top, and then re-write the entire data into GeoTIFF format using Matlab's geotiffwrite function.

I am currently no longer working in GeoScience field, so I am afraid that I cannot provide you with more useful advise.

Comments and Ratings on Jimmy's Files View all
Updated File Comment by Comments Rating
02 May 2012 Tools for NIfTI and ANALYZE image Load, save, make, reslice, view (and edit) both NIfTI and ANALYZE data on any platform Author: Jimmy Shen Mark

Thanks, that's exactly what I wanted to know!

30 Apr 2012 Tools for NIfTI and ANALYZE image Load, save, make, reslice, view (and edit) both NIfTI and ANALYZE data on any platform Author: Jimmy Shen Shen, Jimmy

Sure Mark. You need a reference image by the way, so you can see what will happen before and after you apply the transformation matrix. Here's the example:

1. Download "avg152T1_RL_nifti.nii" from NIfTI site. I use it as reference image.

2. View how the reference image looks like: nii=load_nii('avg152T1_RL_nifti.nii');
view_nii(nii);

3. Assume that I have a Transformation Matrix, which will let the reference image turn 30 degree counter-clockwise on XY plane, here will be the matrix: T=[cos(pi/6) -sin(pi/6) 0; sin(pi/6) cos(pi/6) 0; 0 0 1];

4. Get old_xyz from reference image: rl=load_untouch_nii('avg152T1_RL_nifti.nii');
old_xyz=[rl.hdr.hist.srow_x(1:3);rl.hdr.hist.srow_y(1:3);rl.hdr.hist.srow_z(1:3)];

5. Apply your transformation matrix, and save new_xyz into a new image: new_xyz=T*old_xyz; rl.hdr.hist.srow_x(1:3)=new_xyz(1,:); rl.hdr.hist.srow_y(1:3)=new_xyz(2,:); rl.hdr.hist.srow_z(1:3)=new_xyz(3,:); save_untouch_nii(rl, 'rl30.nii'); Now you already have the "rl30.nii", which is a transformed NIfTI image can be used anywhere.

6. In order to view this image using my toolbox, you need to reslice it: reslice_nii('rl30.nii', 'rl30b.nii'); Now, you can load and view the rotated image: rl30b=load_nii('rl30b.nii'); view_nii(rl30b);

Hopefully this answers your questions.

30 Apr 2012 Tools for NIfTI and ANALYZE image Load, save, make, reslice, view (and edit) both NIfTI and ANALYZE data on any platform Author: Jimmy Shen Mark

Hello,

Is it possible to use reslice_nii to apply a transform to a nifti volume? for example, if I have a transformation matrix that is the result of a 3D coregistration of a functional with an anatomical volume, could I use reslice_nii to apply that transformation matrix to the functional volume to transform it into anatomical space? If so, any chance of some example code?

Thanks very much for the useful code.

27 Apr 2012 geotiffwrite Write a 2D or 3D array to a single or multi-band GeoTIFF file Author: Jimmy Shen M, Carlo

thank you very much Jimmy

26 Apr 2012 geotiffwrite Write a 2D or 3D array to a single or multi-band GeoTIFF file Author: Jimmy Shen Shen, Jimmy

You need to use MATLAB's geotiffread to read L7 file into matrix, with all attributes. Then find out the index of your sub-region, and assign the sub-region to a new matrix. You can now use the make_option option in my package to select optional fields. However, you need to match the attributes that you read, and select the correct fields by yourself in order to create the optional fields to be used in my geotiffwrite. Since I don't have Mapping toolbox, I am afraid that I cannot provide you with more details.

Top Tags Applied by Jimmy
image, 3d, format, graphics, medical
Files Tagged by Jimmy View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
06 Mar 2012 geotiffwrite Write a 2D or 3D array to a single or multi-band GeoTIFF file Author: Jimmy Shen earth sciences, dem, earth science, gps, gis, image 59 18
  • 5.0
5.0 | 6 ratings
21 Sep 2011 Screenshot Tools for NIfTI and ANALYZE image Load, save, make, reslice, view (and edit) both NIfTI and ANALYZE data on any platform Author: Jimmy Shen analyze, nifti, image, medical, isotropic, niftl 463 102
  • 4.58065
4.6 | 32 ratings
28 Mar 2011 Screenshot Edit plotted data with mouse Edit plotted data by picking any point on the curve and moving the mouse. Author: Jimmy Shen graphics, gui, demo, mouse movement, edit data 14 0
22 Feb 2011 Load BIOPAC ACQ (AcqKnowledge for PC) data Load BIOPAC's *.acq file (AcqKnowledge for Windows data format). Author: Jimmy Shen medical, biopac acqknowledge, acq, eeg, file, data 30 14
  • 4.71429
4.7 | 7 ratings
16 Apr 2009 Screenshot Resampling volume or image with affine matrix Use affine matrix to convert 3D vol or 2D img to orthogonal one with corresponding affine matrix. Author: Jimmy Shen 2d, affine, 3d, image, volume, voxel 51 7
  • 4.5
4.5 | 4 ratings

Contact us at files@mathworks.com