Hi Eugenio, I just wanted to follow up and see if you could tell anything about what was going on from the response I got to running "mri_robust_register" as you suggested.
---------- Forwarded message ---------- From: Max Owens owensmax03@gmail.com Date: Wed, Sep 27, 2017 at 3:51 PM Subject: Re: [Freesurfer] Problem with New Hippocampus/Amygdala Segmentation To: Freesurfer support list freesurfer@nmr.mgh.harvard.edu
Hi Eugenio,
Thank you for taking the time to answer my question. When I run the command "mri_robust_register" it returns the help file (below). Is that what you would expect?
Max
Help
NAME mri_robust_register
SYNOPSIS mri_robust_register --mov <mov.mgz> --dst <dst.mgz> --lta <reg.lta> [options]
DESCRIPTION This program computes an inverse consistent registration of two volumes, via an interative symmetric alignment of the two images. Default transformation type is rigid (translation and rotation), but affine can be specified (--affine). The program contains both robust (outlier insensitive) and standard cost functions: The robust approach uses a method based on robust statistics to detect outliers and removes them from the registration. This leads to highly accurate registrations even with local changes in the image (e.g. jaw movement). For same modality use costfunction ROB (default) and ROBENT for cross modal registration (experimental and only tested for isotropic voxels). An additional optional intensity scale parameter (--iscale) can be used to adjust for global intensity differences. Regular non-robust cost functions include (nromalized) mutual information (MI and NMI) and can be used for cross modal registration without robustness.
If the registration fails: The registration can fail because of several reasons, most likely due to large intensity differences or non-linear differences in the image. You can try: * Switch on intensity scaling (--iscale) (for ROB and ROBENT). * Switch off the center of mass initialization (with --noinit). * If you are trying to estimate an --affine registration, try rigid first and then pass it with --ixform to the affine step in a second run. * Depending on your image resoution, it may be that the coarsest level is too coarse, misaligning the image. Try to specify a larger --minsize to avoid computation on very coarse scales (especially for 2D registrations, e.g. --minsize 120, for 3d --minsize 40). * If you used automatic saturation estimation in ROB or ROBENT (--satit), try to specify the sensitivity manually via --sat. A high sat is less sensitive to outliers, low is more sensitive (range approx. from 4 to 20 in most cases). * If you specified a manual saturation in ROB or ROBENT (--sat) too many voxels might be considered outlier early in the process. You can check this by outputing the weights (--weights ow.mgz) and by looking at them in: freeview dst.mgz mappedmov.mgz ow.mgz:colormap=heat If most of the brain is labeled outlier (red/yellow), try to set the saturation to a higher value (eg. --sat 12) or use --satit to automatically determine a good sat value. --satit works best for 3D brain images.
POSITIONAL ARGUMENTS None.
REQUIRED FLAGGED ARGUMENTS --mov <mov.mgz> input movable volume to be aligned to target
--dst <dst.mgz> input target volume
--lta <reg.lta> output registration (transform from mov to dst)
One of the following is required for sensitivity when using ROB or ROBENT (robust cost functions, default):
--sat <real> for ROB and ROBENT: set outlier sensitivity manually (e.g. '--sat 4.685' ). Higher values mean less sensitivity. Check --weights to see how much outliers get detected and adjust this parameter manually.
--satit for ROB and ROBENT: auto-detect good sensitivity (works best for head or full brain images). You can manually specify sat if satit does not give satisfying results.
OPTIONAL FLAGGED ARGUMENTS --mapmov <aligned.mgz> output image: movable mapped and resampled at destination
--mapmovhdr <aligned.mgz> output image: movable aligned to destination (no resampling, only adjusting header vox2ras)
--weights <weights.mgz> output weights (outlier probabilities) in destination space (0=regular,1=outlier)
--oneminusw weights (outlier) map will be inverted (0=outlier), as in earlier versions
--iscale estimate intensity scale factor (default no). Highly recommended for unnormalized images when using ROB or ROBENT!
--iscaleonly only perform iscale (no transformation, default off)
--iscaleout <fname.txt> output text file for iscale value (will activate --iscale). Default: no iscale output
--iscalein <fname.txt> initial input text file for iscale value (probably you want to also activate --iscale to estimate final value?)
--transonly find 3 parameter translation only
--affine find 12 parameter affine transform
--ixform lta use initial transform lta on source. Default: align centers of mass (see also --noinit). The final output transform will be from source to target and thus include the ixform.
--initorient use moments for orientation initialization (default false). Recommended for stripped brains, but not with full head images with different cropping.
--noinit skip automatic transform initialization. Default: translate images to align centers of mass, good for within subject full head or brain images. Use --noinit if center of mass is meaningless, e.g. when registering different resolutions or parts to larger images.
--vox2vox output VOX2VOX lta file (default is RAS2RAS)
--cost <str> Cost function: ROB (robust) <- default, for robust same modality registration. ROBENT (robust entropy) experimental, for robust cross modal registration, can be slow. Also see --entradius, --entball, --entcorrection. MI (mutual information), NMI (normalized mutual information), MI, NMI are also good for x-modal (not robust). ECC (entropy correlation coefficient) experimental, NCC (normalized cross corrrelation) experimental, SCR (symetrized correlation ratio) experimental. Note: most cost functions require the image backgrounds to be black! Also, only ROB and ROBENT use gradient decend, the others use a Powell optimizer.
--entradius with ROBENT: specify box radius for entropy computation, default: 5 (may be slow)
--entcorrection with ROBENT: uses better entropy computation that works on smaller boxes. For 3D recommended to switch this on and set entradius to around 2.
--entball with ROBENT: use ball around voxel instead of box (default no), does not seem to make a big difference.
--entmov <entmov.mgz> with ROBENT: write movable entropy image.
--powelltol <real> with MI,NMI etc: set Powell tolerance (default 0.00001 = 1e-5).
--nosym do not map to half way space, but resample mov to dst internally (destroys symmetry, but is useful when registering a larger block to a part)
--maxit <#>
--entdst <entdst.mgz> with ROBENT: write target entropy image. iterate max # times on each resolution (default 5)
--highit <#> iterate max # times on highest resolution (default 5)
--epsit <real> stop iterations when transform update falls below <real> RMS distance (default 0.01)
--nomulti process highest resolution only (no multiscale)
--maxsize <#> specify largest dimension for gaussian pyramid (will not process resolutions higher than #). Default: process up to the input resolution. You can use this to prevent the algorithm to run on the high resolutions (to avoid long runtimes and memory issues)
--minsize <#> specify smallest dimension for gaussian pyramid (will not downsample resolutions smaller than #). Default: smallest dimension 16
--wlimit <real> (expert option) sets maximal outlier limit for --satit (default 0.16), reduce to decrease outlier sensitivity
--subsample <real> subsample if dim > # on all axes (default no subsampling)
--floattype convert images to float internally (default: keep input type)
--maskmov <mask.mgz> mask mov image with mask.mgz
--maskdst <mask.mgz> mask dst image with mask.mgz
--halfmov <hm.mgz> outputs half-way mov (resampled in halfway space)
--halfdst <hd.mgz> outputs half-way dst (resampled in halfway space)
--halfweights hw.mgz outputs half-way weights (resampled in halfway space)
--halfmovlta hm.lta outputs transform from mov to half-way space
--halfdstlta hd.lta outputs transform from dst to half-way space
--debug show debug output (default no debug output)
--verbose 0 quiet, 1 normal (default), 2 detail
EXAMPLE 1 Simple Full Head Registration (same modality):
mri_robust_register --mov vol1.mgz --dst vol2.mgz --lta v1to2.lta --mapmov v1to2.mgz --weights v1to2-weights.mgz --iscale --satit
Computes the symmetric rigid registration (translation and rotation) of vol1.mgz to vol2.mgz using robust statistics and with an additional global intensity scaling parameter. The output is the transform (v1to2.lta) and image v1to2.mgz (the vol1.mgz resampled to the target image). Additionally the weights of the robust registation (outlier detection) are saved. Everything can be viewed with:
freeview vol2.mgz v1to2.mgz v1to2-weights.mgz:colormap=heat
EXAMPLE 2 Half Way Space Output (same modality):
mri_robust_register --mov vol1.nii --dst vol2.nii --lta v1to2.lta --halfmov h1.nii --halfdst h2.nii --halfmovlta h1.lta --halfdstlta h2.lta --iscale --satit
Computes the rigid robust registration with intensity scaling of Nifti vol1 to vol2 (the registration will be saved in v1to2.lta). Additionally outputs the half-way volumes h1.nii and h2.nii (with corresponding transforms h1.lta and h2.lta). As both volumes are mapped to the half-way space, they will both be resampled. This can be used to construct an unbiased mean volume (e.g. with mri_average) or to compute change maps. The output can be viewed with:
freeview h1.nii h2.nii
EXAMPLE 3 Part to Full Registration (same modality):
mri_robust_register --mov fullhemi.mgz --dst part.mgz --noinit --nosym --sat 8 --maxsize 380 --mapmovhdr hemi2part.mgz --lta hemi2part.lta
Registers a full hemisphere with a high-resolutional part (e.g. hippocampal slices). It is recommended to specify the part as the target (the full hemi image will then be cropped internally). For partial registration to work we need to skip the center of mass initialization (--noinit) and switch off the half way space (--nosym). Also the inputs need to be in an approximate alignment, alternatively you can pass --ixform with a transform that approximately aligns the images. The satuarion needs to be specified manually with --sat. You can output the weights with --weights to see if too many voxels are removed and increase the value (to reduce outlier sensitivity). For high-res inputs we limit the resolution to 380 to reduce run time and mem usage. The output will be the transform (--lta) and the mov mapped to dst w/o resampling (--mapmovhdr), only adjusting the header information. Look at results with:
freeview -v part.mgz part2hemi.mgz
You can also invert transforms and apply them :
mri_concatenate_lta -invert1 hemi2part.lta identity.nofile part2hemi.lta
mri_convert -at inv1.lta part.mgz part2hemi.mgz
EXAMPLE 4 Robust cross modal registration:
mri_robust_register --mov movT2.mgz --dst dstT1.mgz --satit --iscale --mapmov T2_to_T1.mgz --lta T2_to_T1.lta --cost ROBENT --entradius 2 --entcorrection --weights T2_to_T1_weights.mgz
Registers a T2 image to T1 using robust entropy with correction mode and box radius 2 (= side length of 5 for boxes). Look at results with:
freeview dstT1.mgz T2_to_T1.mgz T2_to_T1_weights.mgz:colormap=heat
EXAMPLE 5 Standard cross modal registration:
mri_robust_register --mov movT2.mgz --dst dstT1.mgz --mapmov T2_to_ T1.mgz --lta T2_to_T1.lta --cost NMI
Registers a T2 image to T1 using normalized mutual information (no outlier detection, Powell method is used for optimization). Here no saturation or intensity scaling is necessary. NMI or MI may be the prefered option for non-isotropic voxel whereas ROBENT has not been tested much. Also if you register a slab to a whole image you should probably add --nosym and play around with masking the images (e.g. --maskmov brainmask ). Look at results with:
freeview dstT1.mgz T2_to_T1.mgz
REFERENCES
Please cite this:
Highly Accurate Inverse Consistent Registration: A Robust Approach, M. Reuter, H.D. Rosas, B. Fischl. NeuroImage 53(4):1181-1196, 2010. http://dx.doi.org/10.1016/j.neuroimage.2010.07.020 http://reuter.mit.edu/papers/reuter-robreg10.pdf
Extension to multi registration (template estimation):
Within-Subject Template Estimation for Unbiased Longitudinal Image Analysis. M. Reuter, N.J. Schmansky, H.D. Rosas, B. Fischl. NeuroImage 61(4):1402-1418, 2012. http://dx.doi.org/10.1016/j.neuroimage.2012.02.084 http://reuter.mit.edu/papers/reuter-long12.pdf
REPORTING Report bugs to freesurfer@nmr.mgh.harvard.edu
SEE ALSO mri_robust_template (to simultaneously register 2 or more inputs to an unbiased mid space, e.g. to create within subject cross time template image)
On Mon, Sep 25, 2017 at 3:23 PM, Iglesias Gonzalez, Eugenio < e.iglesias@ucl.ac.uk> wrote:
Dear Max,
It seems that a basic call to mri_robust_register is failing. Can you please try running this command, to make sure that there isn’t a problem with the license?
Cheers,
/Eugenio
--
Juan Eugenio Iglesias
ERC Senior Research Fellow
Translational Imaging Group
University College London
*From: *freesurfer-bounces@nmr.mgh.harvard.edu on behalf of Max Owens < owensmax03@gmail.com> *Reply-To: *Freesurfer support list freesurfer@nmr.mgh.harvard.edu *Date: *Friday, 22 September 2017 at 22:21 *To: *"freesurfer@nmr.mgh.harvard.edu" freesurfer@nmr.mgh.harvard.edu *Subject: *[Freesurfer] Problem with New Hippocampus/Amygdala Segmentation
Hi Freesurfer Experts,
I'm trying to run the new version 6.0 hippocampus/amygdala segmentation procedure (https://surfer.nmr.mgh.harvard.edu/fswiki/HippocampalSubfields) on data from subjects with whom I have already completed recon-all. I have downloaded the newest development version (and license), as well as the required matlab runtime. However, I am getting the following error:
“LD_LIBRARY_PATH is .:freesurfer/MCRv80//runtime/g lnxa64:freesurfer/MCRv80//bin/glnxa64:freesurfer/MCRv80// sys/os/glnxa64:freesurfer/MCRv80//sys/java/jre/glnxa64/jre/ lib/amd64/native_threads:freesurfer/MCRv80//sys/java/jre/ glnxa64/jre/lib/amd64/server:freesurfer/MCRv80//sys/java/ jre/glnxa64/jre/lib/amd64/client:freesurfer/MCRv80//sys/ java/jre/glnxa64/jre/lib/amd64:
Registering imageDump.mgz to hippocampal mask from ASEG
cp: cannot stat ‘freesurfer/average/HippoSF/atlas/AtlasDump.mgz’: No such file or directory
Error using myMRIread (line 16)
Error in myMRIread: temporary directory does not exist
Error in segmentSubjectT1_autoEstimateAlveusML (line 134)
Command exited with non-zero status 255
@#@FSTIME 2017:09:22:15:55:53 run_segmentSubjectT1_autoEstimateAlveusML.sh N 13 e 2.85 S 0.11 U 2.85 P 103% M 205292 F 1 R 22759 W 0 c 2477 w 641 I 0 O 63584 L 0.41 0.56 0.64
@#@FSLOADPOST 2017:09:22:15:55:56 run_segmentSubjectT1_autoEstimateAlveusML.sh N 13 0.41 0.56 0.64
All done! ”
Have you ever seen this error before? If not, can you provide any suggestions for ways that I might troubleshoot it? I have attached the command I used and the error log if this is of help.
Thanks very much for your time,
Max
--
Max Owens, M.S.
Graduate Student in Psychology
Clinical Neuroscience Lab
University of Georgia
Freesurfer mailing list 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.