open-discussion
open-discussion > RE: Non-Linear using Fnirt in Fcon1000 Preprocess
Aug 18, 2011 06:08 PM | James Porter
RE: Non-Linear using Fnirt in Fcon1000 Preprocess
Rowen-
Double-check your file nomenclature and pathways that you are asking fnirt to use. In my experience, the errors of "failed to find header file," "Could not open matrix file," and "NEWMAT::IncompatibleDimensionsException" generally come up when you ask the program to open a file that doesn't exist. For me, 99% of the time this means I have a typo in my script.
-Jim
Originally posted by Rowen Morioka:
Double-check your file nomenclature and pathways that you are asking fnirt to use. In my experience, the errors of "failed to find header file," "Could not open matrix file," and "NEWMAT::IncompatibleDimensionsException" generally come up when you ask the program to open a file that doesn't exist. For me, 99% of the time this means I have a typo in my script.
-Jim
--
Jim Porter, M.A.
Ph.D. Candidate, NIMH Predoctoral Trainee
Clinical Science & Psychopathology Research
University of Minnesota
Originally posted by Rowen Morioka:
Hi there,
I am not sure how exactly to execute non-linear registration using the 0_preprocessing.sch. In the "3_registration.sch" - I modified the script from "flirt" = linear reg to "fnirt" = non linear (see below) :
## 4. T1->STANDARD
## NOTE THAT THIS IS Linear registration, you may want to use FNIRT (non-linear)
fnirt -ref standard -in highres -out highres2standard -omat highres2standard.mat -cost corratio -searchcost corratio -dof 12 -interp trilinear
## Create mat file for conversion from standard to high res
convert_xfm -inverse -omat standard2highres.mat highres2standard.mat
After I changed it to fnirt, I executed 0_Preprocessing.sh for one subject only. Everything appeared to be working, however, upon REGISTRATION step - I get the following output (please see below). Do you have recommendations on how to use FNIRT for non linear reg? I'm sure there are other ways to do this, however, any input would be greatly appreciated. Thanks for your time!
Rowen
Output of errors read:
------------------------------
!!!! RUNNING REGISTRATION !!!!
------------------------------
Part of FSL (build 418)
fnirt
Usage:
fnirt --ref= --in=
fnirt --ref= --in= --infwhm=8,4,2 --subsamp=4,2,1 --warpres=8,8,8
Compulsory arguments (You MUST set one or more of):
--ref name of reference image
--in name of input image
Optional arguments (You may optionally specify one or more of):
--aff name of file containing affine transform
--inwarp name of file containing initial non-linear warps
--intin name of file/files containing initial intensity maping
--cout name of output file with field coefficients
--iout name of output image
--fout name of output file with field
--jout name of file for writing out the Jacobian of the field (for diagnostic or VBM purposes)
--refout name of file for writing out intensity modulated --ref (for diagnostic purposes)
--intout name of files for writing information pertaining to intensity mapping
--logout Name of log-file
--config Name of config file specifying command line arguments
--refmask name of file with mask in reference space
--inmask name of file with mask in input image space
--applyrefmask Use specified refmask if set, deafult 1 (true)
--applyinmask Use specified inmask if set, deafult 1 (true)
--imprefm If =1, use implicit masking based on value in --ref image. Default =1
--impinm If =1, use implicit masking based on value in --in image, Default =1
--imprefval Value to mask out in --ref image. Default =0.0
--impinval Value to mask out in --in image. Default =0.0
--miter Max # of non-linear iterations, default 5,5,5,5
--subsamp sub-sampling scheme, default 4,2,1,1
--warpres (approximate) resolution (in mm) of warp basis in x-, y- and z-direction, default 10,10,10
--splineorder Order of spline, 2->Qadratic spline, 3->Cubic spline. Default=3
--infwhm FWHM (in mm) of gaussian smoothing kernel for input volume, default 6,4,2,2
--reffwhm FWHM (in mm) of gaussian smoothing kernel for ref volume, default 4,2,0,0
--regmod Model for regularisation of warp-field [membrane_energy bending_energy], default bending_energy
--lambda Weight of regularisation, default depending on --ssqlambda and --regmod switches. See user documetation.
--ssqlambda If set (=1), lambda is weighted by current ssq, default 1
--jacrange Allowed range of Jacobian determinants, default 0.01,100.0
--refderiv If =1, ref image is used to calculate derivatives. Default =0
--intmod Model for intensity-mapping [none global_linear global_non_linear local_linear global_non_linear_with_bias local_non_linear]
--intorder Order of poynomial for mapping intensities, default 5
--biasres Resolution (in mm) of bias-field modelling local intensities, default 50,50,50
--biaslambda Weight of regularisation for bias-field, default 10000
--estint Estimate intensity-mapping if set, deafult 1 (true)
--numprec Precision for representing Hessian, double or float. Default double
-v,--verbose Print diagonostic information while running
-h,--help display help info
-r: Option doesn't exist!
Could not open matrix file highres2standard.mat
Cannot read input-matrix
Could not open matrix file highres2standard.mat
Cannot read concat-matrix
Could not open matrix file example_func2standard.mat
terminate called after throwing an instance of 'NEWMAT::IncompatibleDimensionsException'
/Users/motherproject/Desktop/data/scripts/3_registration.sh: line 71: 4405 Abort trap flirt -ref standard -in example_func -out example_func2standard -applyxfm -init example_func2standard.mat -interp trilinear
Could not open matrix file example_func2standard.mat
Cannot read input-matrix
/Users/motherproject/Desktop/data/scripts/tissuepriors/3mm/
------------------------------
!!!! RUNNING SEGMENTATION !!!!
------------------------------
Segmenting brain for smj016
Creating global mask
++ 3dcopy: AFNI version=AFNI_2009_12_31_1431 (Mar 5 2010) [32-bit]
Registering smj016 csf to native (functional) space
Smoothing smj016 csf
Registering smj016 csf to standard space
Could not open matrix file /Users/motherproject/Desktop/data/scripts/smj016/reg/example_func2standard.mat
terminate called after throwing an instance of 'NEWMAT::IncompatibleDimensionsException'
/Users/motherproject/Desktop/data/scripts/4_segment.sh: line 70: 4418 Abort trap flirt -in ${segment_dir}/csf_sm -ref ${reg_dir}/standard -applyxfm -init ${reg_dir}/example_func2standard.mat -out ${segment_dir}/csf2standard
Finding overlap between smj016 csf and prior
** ERROR (nifti_image_read): failed to find header file for '/Users/motherproject/Desktop/data/scripts/smj016/segment/csf2standard'
** ERROR: nifti_image_open(/Users/motherproject/Desktop/data/scripts/smj016/segment/csf2standard): bad header info
ERROR: failed to open file /Users/motherproject/Desktop/data/scripts/smj016/segment/csf2standard
Cannot open volume /Users/motherproject/Desktop/data/scripts/smj016/segment/csf2standard for reading!
Registering smj016 csf back to native space
** ERROR (nifti_image_read): failed to find header file for '/Users/motherproject/Desktop/data/scripts/smj016/segment/csf_masked'
** ERROR: nifti_image_open(/Users/motherproject/Desktop/data/scripts/smj016/segment/csf_masked): bad header info
ERROR: failed to open file /Users/motherproject/Desktop/data/scripts/smj016/segment/csf_masked
ERROR: Could not open image /Users/motherproject/Desktop/data/scripts/smj016/segment/csf_masked
Image Exception : #22 :: Failed to read volume /Users/motherproject/Desktop/data/scripts/smj016/segment/csf_masked
terminate called after throwing an instance of 'RBD_COMMON::BaseException'
/Users/motherproject/Desktop/data/scripts/4_segment.sh: line 76: 4420 Abort trap flirt -in ${segment_dir}/csf_masked -ref ${reg_dir}/example_func -applyxfm -init ${reg_dir}/standard2example_func.mat -out ${segment_dir}/csf_native
Threshold and binarize smj016 csf probability map
** ERROR (nifti_image_read): failed to find header file for '/Users/motherproject/Desktop/data/scripts/smj016/segment/csf_native'
** ERROR: nifti_image_open(/Users/motherproject/Desktop/data/scripts/smj016/segment/csf_native): bad header info
ERROR: failed to open file /Users/motherproject/Desktop/data/scripts/smj016/segment/csf_native
Cannot open volume /Users/motherproject/Desktop/data/scripts/smj016/segment/csf_native for reading!
Mask csf image by smj016 functional
I am not sure how exactly to execute non-linear registration using the 0_preprocessing.sch. In the "3_registration.sch" - I modified the script from "flirt" = linear reg to "fnirt" = non linear (see below) :
## 4. T1->STANDARD
## NOTE THAT THIS IS Linear registration, you may want to use FNIRT (non-linear)
fnirt -ref standard -in highres -out highres2standard -omat highres2standard.mat -cost corratio -searchcost corratio -dof 12 -interp trilinear
## Create mat file for conversion from standard to high res
convert_xfm -inverse -omat standard2highres.mat highres2standard.mat
After I changed it to fnirt, I executed 0_Preprocessing.sh for one subject only. Everything appeared to be working, however, upon REGISTRATION step - I get the following output (please see below). Do you have recommendations on how to use FNIRT for non linear reg? I'm sure there are other ways to do this, however, any input would be greatly appreciated. Thanks for your time!
Rowen
Output of errors read:
------------------------------
!!!! RUNNING REGISTRATION !!!!
------------------------------
Part of FSL (build 418)
fnirt
Usage:
fnirt --ref= --in=
fnirt --ref= --in= --infwhm=8,4,2 --subsamp=4,2,1 --warpres=8,8,8
Compulsory arguments (You MUST set one or more of):
--ref name of reference image
--in name of input image
Optional arguments (You may optionally specify one or more of):
--aff name of file containing affine transform
--inwarp name of file containing initial non-linear warps
--intin name of file/files containing initial intensity maping
--cout name of output file with field coefficients
--iout name of output image
--fout name of output file with field
--jout name of file for writing out the Jacobian of the field (for diagnostic or VBM purposes)
--refout name of file for writing out intensity modulated --ref (for diagnostic purposes)
--intout name of files for writing information pertaining to intensity mapping
--logout Name of log-file
--config Name of config file specifying command line arguments
--refmask name of file with mask in reference space
--inmask name of file with mask in input image space
--applyrefmask Use specified refmask if set, deafult 1 (true)
--applyinmask Use specified inmask if set, deafult 1 (true)
--imprefm If =1, use implicit masking based on value in --ref image. Default =1
--impinm If =1, use implicit masking based on value in --in image, Default =1
--imprefval Value to mask out in --ref image. Default =0.0
--impinval Value to mask out in --in image. Default =0.0
--miter Max # of non-linear iterations, default 5,5,5,5
--subsamp sub-sampling scheme, default 4,2,1,1
--warpres (approximate) resolution (in mm) of warp basis in x-, y- and z-direction, default 10,10,10
--splineorder Order of spline, 2->Qadratic spline, 3->Cubic spline. Default=3
--infwhm FWHM (in mm) of gaussian smoothing kernel for input volume, default 6,4,2,2
--reffwhm FWHM (in mm) of gaussian smoothing kernel for ref volume, default 4,2,0,0
--regmod Model for regularisation of warp-field [membrane_energy bending_energy], default bending_energy
--lambda Weight of regularisation, default depending on --ssqlambda and --regmod switches. See user documetation.
--ssqlambda If set (=1), lambda is weighted by current ssq, default 1
--jacrange Allowed range of Jacobian determinants, default 0.01,100.0
--refderiv If =1, ref image is used to calculate derivatives. Default =0
--intmod Model for intensity-mapping [none global_linear global_non_linear local_linear global_non_linear_with_bias local_non_linear]
--intorder Order of poynomial for mapping intensities, default 5
--biasres Resolution (in mm) of bias-field modelling local intensities, default 50,50,50
--biaslambda Weight of regularisation for bias-field, default 10000
--estint Estimate intensity-mapping if set, deafult 1 (true)
--numprec Precision for representing Hessian, double or float. Default double
-v,--verbose Print diagonostic information while running
-h,--help display help info
-r: Option doesn't exist!
Could not open matrix file highres2standard.mat
Cannot read input-matrix
Could not open matrix file highres2standard.mat
Cannot read concat-matrix
Could not open matrix file example_func2standard.mat
terminate called after throwing an instance of 'NEWMAT::IncompatibleDimensionsException'
/Users/motherproject/Desktop/data/scripts/3_registration.sh: line 71: 4405 Abort trap flirt -ref standard -in example_func -out example_func2standard -applyxfm -init example_func2standard.mat -interp trilinear
Could not open matrix file example_func2standard.mat
Cannot read input-matrix
/Users/motherproject/Desktop/data/scripts/tissuepriors/3mm/
------------------------------
!!!! RUNNING SEGMENTATION !!!!
------------------------------
Segmenting brain for smj016
Creating global mask
++ 3dcopy: AFNI version=AFNI_2009_12_31_1431 (Mar 5 2010) [32-bit]
Registering smj016 csf to native (functional) space
Smoothing smj016 csf
Registering smj016 csf to standard space
Could not open matrix file /Users/motherproject/Desktop/data/scripts/smj016/reg/example_func2standard.mat
terminate called after throwing an instance of 'NEWMAT::IncompatibleDimensionsException'
/Users/motherproject/Desktop/data/scripts/4_segment.sh: line 70: 4418 Abort trap flirt -in ${segment_dir}/csf_sm -ref ${reg_dir}/standard -applyxfm -init ${reg_dir}/example_func2standard.mat -out ${segment_dir}/csf2standard
Finding overlap between smj016 csf and prior
** ERROR (nifti_image_read): failed to find header file for '/Users/motherproject/Desktop/data/scripts/smj016/segment/csf2standard'
** ERROR: nifti_image_open(/Users/motherproject/Desktop/data/scripts/smj016/segment/csf2standard): bad header info
ERROR: failed to open file /Users/motherproject/Desktop/data/scripts/smj016/segment/csf2standard
Cannot open volume /Users/motherproject/Desktop/data/scripts/smj016/segment/csf2standard for reading!
Registering smj016 csf back to native space
** ERROR (nifti_image_read): failed to find header file for '/Users/motherproject/Desktop/data/scripts/smj016/segment/csf_masked'
** ERROR: nifti_image_open(/Users/motherproject/Desktop/data/scripts/smj016/segment/csf_masked): bad header info
ERROR: failed to open file /Users/motherproject/Desktop/data/scripts/smj016/segment/csf_masked
ERROR: Could not open image /Users/motherproject/Desktop/data/scripts/smj016/segment/csf_masked
Image Exception : #22 :: Failed to read volume /Users/motherproject/Desktop/data/scripts/smj016/segment/csf_masked
terminate called after throwing an instance of 'RBD_COMMON::BaseException'
/Users/motherproject/Desktop/data/scripts/4_segment.sh: line 76: 4420 Abort trap flirt -in ${segment_dir}/csf_masked -ref ${reg_dir}/example_func -applyxfm -init ${reg_dir}/standard2example_func.mat -out ${segment_dir}/csf_native
Threshold and binarize smj016 csf probability map
** ERROR (nifti_image_read): failed to find header file for '/Users/motherproject/Desktop/data/scripts/smj016/segment/csf_native'
** ERROR: nifti_image_open(/Users/motherproject/Desktop/data/scripts/smj016/segment/csf_native): bad header info
ERROR: failed to open file /Users/motherproject/Desktop/data/scripts/smj016/segment/csf_native
Cannot open volume /Users/motherproject/Desktop/data/scripts/smj016/segment/csf_native for reading!
Mask csf image by smj016 functional
Threaded View
Title | Author | Date |
---|---|---|
Rowen Morioka | Aug 18, 2011 | |
Christine Zakrzewski | Aug 20, 2011 | |
Cartik Sharma | Aug 19, 2011 | |
James Porter | Aug 18, 2011 | |
Clare Kelly | Aug 18, 2011 | |