How was the volume that holds the manual segs created? Another thing you can try is
mri_vol2vol --mov lh.hippoSfLabels-T1.v10.mgz --targ mansegs.nii --regheader --o FS_outfile.nii On 07/09/2015 03:59 PM, von Polier, Georg wrote: > > Different in nii: type: FLOAT (3); TE, TI, flip angle: 0; PhEncDir: > Unknown; > > xform info, voxel to ras transform, ras to voxel identical > > > Loading rawavg.nii and FS_outfile.nii in ITK looks in perfect > alignment, it says orientation of FS_outfile is Oblique (closest to ASR); > When I load the manual segents, (into rawavg) it warns of header > mismatch (orientation ASL) and I notice a slight shift. > > Loading the FS_outfile into the original dicom-file, it equally warns > of header missmatch, I notice a slight shift. > > > > > Volume information for rawavg.mgz > > type: MGH > > dimensions: 256 x 256 x 176 > > voxel sizes: 0.9766, 0.9766, 1.0000 > > type: SHORT (4) > > fov: 250.000 > > dof: 0 > > xstart: -125.0, xend: 125.0 > > ystart: -125.0, yend: 125.0 > > zstart: -88.0, zend: 88.0 > > TR: 1900.00 msec, TE: 2.52 msec, TI: 900.00 msec, flip angle: 9.00 degrees > > nframes: 1 > > PhEncDir: ROW > > ras xform present > > xform info: x_r = -0.0332, y_r = -0.0628, z_r = -0.9975, c_r = > -3.9057 > > : x_a = -0.9995, y_a = 0.0021, z_a = 0.0331, c_a = 14.5730 > > : x_s = 0.0000, y_s = -0.9980, z_s = 0.0628, c_s = -24.5551 > > > talairach xfm : > > Orientation : PIL > > Primary Slice Direction: sagittal > > > voxel to ras transform: > > -0.0324 -0.0613 -0.9975 95.8613 > > -0.9760 0.0020 0.0331 136.3322 > > 0.0000 -0.9746 0.0628 94.6727 > > 0.0000 0.0000 0.0000 1.0000 > > > voxel-to-ras determinant -0.953674 > > > ras to voxel transform: > > -0.0340 -1.0234 0.0000 142.7820 > > -0.0643 0.0021 -1.0220 102.6232 > > -0.9975 0.0331 0.0628 85.1638 > > 0.0000 0.0000 0.0000 1.0000 > > > > Volume information for FS_output.nii > type: nii > dimensions: 256 x 256 x 176 > voxel sizes: 0.9766, 0.9766, 1.0000 > type: FLOAT (3) > fov: 250.000 > dof: 0 > xstart: -125.0, xend: 125.0 > ystart: -125.0, yend: 125.0 > zstart: -88.0, zend: 88.0 > TR: 1900.00 msec, TE: 0.00 msec, TI: 0.00 msec, flip angle: 0.00 degrees > nframes: 1 > PhEncDir: UNKNOWN > ras xform present > xform info: x_r = -0.0332, y_r = -0.0628, z_r = -0.9975, c_r = > -3.9057 > : x_a = -0.9995, y_a = 0.0021, z_a = 0.0331, c_a = 14.5730 > : x_s = 0.0000, y_s = -0.9980, z_s = 0.0628, c_s = -24.5551 > Orientation : PIL > Primary Slice Direction: sagittal > > voxel to ras transform: > -0.0324 -0.0613 -0.9975 95.8613 > -0.9760 0.0020 0.0331 136.3322 > 0.0000 -0.9746 0.0628 94.6727 > 0.0000 0.0000 0.0000 1.0000 > > voxel-to-ras determinant -0.953674 > > ras to voxel transform: > -0.0340 -1.0234 0.0000 142.7820 > -0.0643 0.0021 -1.0220 102.6232 > -0.9975 0.0331 0.0628 85.1638 > 0.0000 0.0000 0.0000 1.0000 > > > >> Am 09.07.2015 um 20:54 schrieb Douglas N Greve >> <gr...@nmr.mgh.harvard.edu <mailto:gr...@nmr.mgh.harvard.edu>>: >> >> vol2vol is the right way to go on this. When you run mri_info on >> rawavg.mgz and FS_outfile.nii, do they have the same geometry? What if >> you convert rawavg.mgz to nii and open it and outfile.nii in ITK Snap, >> so they look the same? >> >> On 07/09/2015 02:44 PM, von Polier, Georg wrote: >>> Thanks for getting back. What I need is hippoSflabels in the original >>> coordinates/space of the dicom-files (to compare with manual >>> segmentation). Basically I had success with >>> mri_convert -rl rawavg.mgz -rt nearest lh.hippoSfLabels-T1.v10.mgz >>> FS_outfile.nii >>> (identical dimensions, voxel spacing, origin and orientation) however, >>> segmentation have wholes that renders shape analysis impossible. Running >>> >>> mri_vol2vol --mov lh.hippoSfLabels-T1.v10.mgz --targ orig/001.mgz >>> --regheader --o FS_outfile.nii --no-save-reg (or —targ rawavg) >>> >>> resulted in perfect segmentations, but the coordinates had (identical >>> dimensions and voxel spacing) but different origin and orientation >>> (dicom: AIL; FS_outfile: ASR) when I open both files in ITK Snap. >>> Also, FS seems to involve more/ other steps in mri_vol2vol as compared >>> to mri_convert. So I figured I would either need other commands for >>> mri_vol2vol or an additional step to have my (perfect) segmention in >>> dicom-coordinates. I tried >>> >>> mri_convert FS_outfile.nii FS_outfile_LPS.nii --in_orientation RAS >>> --out_orientation LPS >>> >>> but the output was completely wrong oriented. >>> >>> So that’s were I am stuck. Back to your question - I guess I need the >>> voxel-to-RAS matrix to have FS-output in the original real world >>> coordinates to enable direct comparisons and then guidance on how to >>> calculate the image translations with FS (on a larger data set). >>> >>> >>> >>>> Am 09.07.2015 um 19:00 schrieb Douglas N Greve >>>> <gr...@nmr.mgh.harvard.edu <mailto:gr...@nmr.mgh.harvard.edu> >>>> <mailto:gr...@nmr.mgh.harvard.edu>>: >>>> >>>> There are a lot of details here that can easily get confused. The pixel >>>> data are not in any particular space. The order of the pixel data are >>>> not changed when converted to mgz. The direction cosines that indicate >>>> how to convert a col-row-slice to a real world coordinate dictate how >>>> the pixels are displayed or interpreted spatially. The direction >>>> cosines >>>> in the dicom file will be LPS. The direction cosines in RAS space are >>>> computed and saved in the mgz file. The coordinate center will not >>>> change. Thus if you use the voxel-to-RAS matrix to compute the location >>>> in the scanner of a given col-row-slice, it will do so accurately. >>>> >>>> Given that, can you explain more about what you actually need? >>>> >>>> >>>> >>>> On 07/08/2015 10:51 AM, von Polier, Georg wrote: >>>>> Sorry for the confusion: According to the presentation >>>>> fswiki/CoordinateSystems (below) I meant, the data are in native >>>>> space/ RAS, with coordinate center not at magnet center, which is >>>>> what I need. >>>>> >>>>> Scanner Space - coordinate center at magnet isocenter, bore axis is >>>>> Z, X to the left, Y to the ceiling. Direction cosines and P0 defined >>>>> in DICOM file (note: this is an LPS, not RAS coordinate system) >>>>> Native - basically the same as scanner, but RAS. >>>>> >>>>> -----Ursprüngliche Nachricht----- >>>>> Von: freesurfer-boun...@nmr.mgh.harvard.edu >>>>> <mailto:freesurfer-boun...@nmr.mgh.harvard.edu> >>>>> <mailto:freesurfer-boun...@nmr.mgh.harvard.edu> >>>>> [mailto:freesurfer-boun...@nmr.mgh.harvard.edu] Im Auftrag von >>>>> Douglas Greve >>>>> Gesendet: Mittwoch, 8. Juli 2015 16:37 >>>>> An: freesurfer@nmr.mgh.harvard.edu >>>>> <mailto:freesurfer@nmr.mgh.harvard.edu> >>>>> <mailto:freesurfer@nmr.mgh.harvard.edu> >>>>> Betreff: Re: [Freesurfer] convert FS volume in scanner space >>>>> >>>>> what do you mean the coords are still in RAS? >>>>> >>>>> On 7/8/15 8:25 AM, von Polier, Georg wrote: >>>>>> My command line was >>>>>> >>>>>> cd $SUBJECTS_DIR/<subjid>/mri >>>>>> mri_vol2vol --mov brain.mgz --targ rawavg.mgz --regheader --o >>>>>> brain-in-rawavg.mgz --no-save-reg >>>>>> >>>>>> according to fswiki/FsAnat-to-NativeAnat. >>>>>> >>>>>> As I mentioned, I am happy with the results but the coordinates are >>>>>> still RAS (from my understanding) and different from the original >>>>>> dicom-coordinates (that my manual segmentations are in). When I use >>>>>> mri_convert, the coordinates are in dicom-space (0 in center of >>>>>> image/ coil; offset and z-axis identical with original dicoms), but >>>>>> the segmentation seems different/ more prone to artifacts, also >>>>>> when I use rt- nearest. >>>>>> >>>>>> Georg >>>>>> >>>>>> -----Ursprüngliche Nachricht----- >>>>>> Von: freesurfer-boun...@nmr.mgh.harvard.edu >>>>>> <mailto:freesurfer-boun...@nmr.mgh.harvard.edu> >>>>>> <mailto:freesurfer-boun...@nmr.mgh.harvard.edu> >>>>>> [mailto:freesurfer-boun...@nmr.mgh.harvard.edu] Im Auftrag von >>>>>> Douglas >>>>>> Greve >>>>>> Gesendet: Mittwoch, 8. Juli 2015 04:20 >>>>>> An: freesurfer@nmr.mgh.harvard.edu >>>>>> <mailto:freesurfer@nmr.mgh.harvard.edu> >>>>>> <mailto:freesurfer@nmr.mgh.harvard.edu> >>>>>> Betreff: Re: [Freesurfer] convert FS volume in scanner space >>>>>> >>>>>> what was your vol2vol command line? What wiki page were you >>>>>> referencing? >>>>>> What was the problem with the coordinates? >>>>>> >>>>>> On 7/7/15 8:11 PM, Bruce Fischl wrote: >>>>>>> I think you meant you want nearest neighbor interpolation, not >>>>>>> trilinear, since you are mapping labels. Try using -rt nearest >>>>>>> insted >>>>>>> On Wed, 8 Jul 2015, von Polier, Georg wrote: >>>>>>> >>>>>>>> Thanks for your reply. I tried mri_convert with -rt interpolate >>>>>>>> (resulting in trilinear interpolation), however, the results were >>>>>>>> partially prone to artifacts and different from those I get with >>>>>>>> mir_vol2vol (but in dicom space). >>>>>>>> >>>>>>>> Is there a way using mir_vol2vol with results in dicom space, or >>>>>>>> a second step that gives a vox2vox from conformed/anatomical >>>>>>>> space to dicom space? >>>>>>>> >>>>>>>> I use the .mgz-output of hippo_subfields (FS_dev). >>>>>>>> >>>>>>>> Thanks again, >>>>>>>> Georg >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>> Am 07.07.2015 um 02:34 schrieb Bruce Fischl >>>>>>>>> <fis...@nmr.mgh.harvard.edu >>>>>>>>> <mailto:fis...@nmr.mgh.harvard.edu> >>>>>>>>> <mailto:fis...@nmr.mgh.harvard.edu>>: >>>>>>>>> >>>>>>>>> Hi Georg >>>>>>>>> >>>>>>>>> if you have a volume (like the 001.mgz) that is in scanner >>>>>>>>> coordinates you can use the "reslice like" and "resample type" >>>>>>>>> flags in mri_convert: >>>>>>>>> >>>>>>>>> mri_convert -rl 001.mgz -rt trilinear input.mgz output.mgz >>>>>>>>> >>>>>>>>> cheers >>>>>>>>> Bruce >>>>>>>>> >>>>>>>>> On Mon, 6 Jul 2015, von >>>>>>>>> Polier, Georg wrote: >>>>>>>>> >>>>>>>>>> Dear FreeSurfers, >>>>>>>>>> >>>>>>>>>> I need to convert an FS-volume back in scanner space (to >>>>>>>>>> calculate overlap with manual segmentation). >>>>>>>>>> I went through the wiki-entry and converted to native space >>>>>>>>>> with mir_vol2vol, however the coordinates are still RAS and not >>>>>>>>>> identical with the original Scanner-coordinates. I tried >>>>>>>>>> mri_convert, however, the results were not as good as >>>>>>>>>> mri_vol2vol (apparently need trilinear interpolation, not >>>>>>>>>> available in mri_convert). >>>>>>>>>> >>>>>>>>>> Any help would be greatly appreciated, >>>>>>>>>> >>>>>>>>>> Cheers, Georg >>>>>>>>>> _______________________________________________ >>>>>>>>>> Freesurfer mailing list >>>>>>>>>> Freesurfer@nmr.mgh.harvard.edu >>>>>>>>>> <mailto:Freesurfer@nmr.mgh.harvard.edu> >>>>>>>>>> <mailto:Freesurfer@nmr.mgh.harvard.edu> >>>>>>>>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> Freesurfer mailing list >>>>>>>>> Freesurfer@nmr.mgh.harvard.edu >>>>>>>>> <mailto:Freesurfer@nmr.mgh.harvard.edu> >>>>>>>>> <mailto:Freesurfer@nmr.mgh.harvard.edu> >>>>>>>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer >>>>>>>>> >>>>>>>>> >>>>>>>>> The information in this e-mail is intended only for the person to >>>>>>>>> whom it is addressed. If you believe this e-mail was sent to >>>>>>>>> you in >>>>>>>>> error and the e-mail contains patient information, please contact >>>>>>>>> the Partners Compliance HelpLine at >>>>>>>>> http://www.partners.org/complianceline . If the e-mail was sent to >>>>>>>>> you in error but does not contain patient information, please >>>>>>>>> contact the sender and properly dispose of the e-mail. >>>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> Freesurfer mailing list >>>>>>>> Freesurfer@nmr.mgh.harvard.edu >>>>>>>> <mailto:Freesurfer@nmr.mgh.harvard.edu> >>>>>>>> <mailto:Freesurfer@nmr.mgh.harvard.edu> >>>>>>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> _______________________________________________ >>>>>>> Freesurfer mailing list >>>>>>> Freesurfer@nmr.mgh.harvard.edu >>>>>>> <mailto:Freesurfer@nmr.mgh.harvard.edu> >>>>>>> <mailto:Freesurfer@nmr.mgh.harvard.edu> >>>>>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer >>>>>>> >>>>>>> >>>>>> _______________________________________________ >>>>>> Freesurfer mailing list >>>>>> Freesurfer@nmr.mgh.harvard.edu >>>>>> <mailto:Freesurfer@nmr.mgh.harvard.edu> >>>>>> <mailto:Freesurfer@nmr.mgh.harvard.edu> >>>>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer >>>>>> >>>>>> _______________________________________________ >>>>>> Freesurfer mailing list >>>>>> Freesurfer@nmr.mgh.harvard.edu >>>>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer >>>>>> >>>>>> >>>>> _______________________________________________ >>>>> Freesurfer mailing list >>>>> Freesurfer@nmr.mgh.harvard.edu >>>>> <mailto:Freesurfer@nmr.mgh.harvard.edu> >>>>> <mailto:Freesurfer@nmr.mgh.harvard.edu> >>>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer >>>>> >>>>> _______________________________________________ >>>>> Freesurfer mailing list >>>>> Freesurfer@nmr.mgh.harvard.edu >>>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer >>>>> >>>>> >>>> >>>> -- >>>> Douglas N. Greve, Ph.D. >>>> MGH-NMR Center >>>> gr...@nmr.mgh.harvard.edu <mailto:gr...@nmr.mgh.harvard.edu> >>>> <mailto:gr...@nmr.mgh.harvard.edu> >>>> Phone Number: 617-724-2358 >>>> Fax: 617-726-7422 >>>> >>>> Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting >>>> <http://surfer.nmr.mgh.harvard.edu/fswiki/BugReporting> >>>> FileDrop: https://gate.nmr.mgh.harvard.edu/filedrop2 >>>> www.nmr.mgh.harvard.edu/facility/filedrop/index.html >>>> <http://www.nmr.mgh.harvard.edu/facility/filedrop/index.html> >>>> Outgoing: >>>> ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/ >>>> >>>> _______________________________________________ >>>> Freesurfer mailing list >>>> Freesurfer@nmr.mgh.harvard.edu >>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer >>> >>> >>> >>> _______________________________________________ >>> Freesurfer mailing list >>> Freesurfer@nmr.mgh.harvard.edu <mailto:Freesurfer@nmr.mgh.harvard.edu> >>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer >> >> -- >> Douglas N. Greve, Ph.D. >> MGH-NMR Center >> gr...@nmr.mgh.harvard.edu <mailto:gr...@nmr.mgh.harvard.edu> >> Phone Number: 617-724-2358 >> Fax: 617-726-7422 >> >> Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting >> FileDrop: https://gate.nmr.mgh.harvard.edu/filedrop2 >> www.nmr.mgh.harvard.edu/facility/filedrop/index.html >> Outgoing: ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/ >> >> _______________________________________________ >> Freesurfer mailing list >> Freesurfer@nmr.mgh.harvard.edu >> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer > > > > _______________________________________________ > Freesurfer mailing list > Freesurfer@nmr.mgh.harvard.edu > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer -- Douglas N. Greve, Ph.D. MGH-NMR Center gr...@nmr.mgh.harvard.edu Phone Number: 617-724-2358 Fax: 617-726-7422 Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting FileDrop: https://gate.nmr.mgh.harvard.edu/filedrop2 www.nmr.mgh.harvard.edu/facility/filedrop/index.html Outgoing: ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/ _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer