questions > reslicing from the command line
Showing 1-4 of 4 posts
Display:
Results per page:
Jun 16, 2016  05:06 PM | anton delehony
reslicing from the command line
Hi all,
I get two dicom folders each containing the t1 and t2 image respectively but with with different voxel sizes. 

To do my analysis, I normally first convert the volumes into nifiti then I reslice one to the other using the GUI.

At the moment however, I'm not sure how I can do that from the command line from a windows computer. Suggestions with the sequence of commands in cmd would be helpful.

Anton
Jun 16, 2016  06:06 PM | Chris Rorden
RE: reslicing from the command line
I think you want to provide a few more details regarding how you "reslice using the GUI". If you are using MRIcron to load one image and then load the next image as an overlay the software will simply reslice the data using the transform provided by the scanner. This is really not a good idea for two reasons. First, reslicing data in this manner is lossy: the interpolation is likely to lose some high frequency information. It is therefore desirable for linear operations to adjust a image header's spatial transformation matrix rather than the data. Second, due to difference in the sequences (e.g. homogeneity, distortion, etc) the T1 and T2 images are unlikely to be precisely aligned to each other. You really want to use a coregistration operation to warp one image to match the other which will attempt to minimize these differences. A nice command line tool for this is FSL's FLIRT, but there are other command line tools that can do this for you (I am thinking of the ANTS and AFNI packages).
Jun 18, 2016  04:06 AM | anton delehony
RE: reslicing from the command line
Hi Chris,

Thanks for writing back. First of all. I should have mentioned that I was talking about dcm2niigui.exe. When I run it and click on file followed by reslice, I can perform the operation that I mentioned in the original post. I need to know if I can somehow perform this operation from the command line in windows. The reason is that I would like to write a script that automate this processes for batch processing.
Jun 20, 2016  04:06 PM | Chris Rorden
RE: reslicing from the command line
Hello-
  With the command line dcm2nii you can use the -x option (e.g. "dcm2nii -x y ~/myDicomFolder") and it will try to save anatomical scans in the closest orthogonal orienation to an identity matrix. As I recall, dcm2niix will automatically do this for 3D acquisitions. I have not written a command line tool for doing this directly to NIfTI images. The prime concern is that you do not want to rotate images that will require slice-time-correction as the available tools expect data from each slice to be saved contiguously on the disk. Since the header reports the orientation and there is the potential for abuse, I do not feel there is a niche for a tool to do this. Having said this, if you are skillful with programming you could roll your own application to do this. The core code is nii_setOrtho, which rotates an image to match the identity matrix and readjusts the S/QForms:
  https://github.com/neurolabusc/dcm2niix/blob/master/console/nii_ortho.cpp

-c