dti_diffeomorphic_population Error: Failed to find header file for 'dti_scl_aff_diffeo.df.nii.gz'

533 views
Skip to first unread message

Molly Memel

unread,
Sep 25, 2014, 7:56:35 PM9/25/14
to dt...@googlegroups.com
Hello,

I have read several threads discussing difficulties with the dti_diffeomorphic_population command. I have gone through all of those threads and made sure that the voxel size of my images are the same as the ixi_aging_template and that the origin is at zero. I also went through the DTI tutorial and the example worked perfectly fine. Every time I run this command, I get the same error that the files for dti_scl_aff_diffeo.df.nii.gz, mean_df.nii.gz, and mean_df_inv.nii.gz are missing. It seems as if these files were never created. I've tried re-running the affine allignment and it doesn't seem to fix the problem. Since I am using the population specific instructions, is there a possibility that those files were never created? Any help would be greatly appreciated.

Here are the commands I used:

dti_template_bootstrap ixi_aging_template.nii.gz subjs.txt
dti_affine_population mean_initial.nii.gz subjs.txt EDS 3
TVtool -in mean_affine3.nii.gz -tr
BinaryThresholdImageFilter mean_affine3_tr.nii.gz mask.nii.gz 0.01 100 1 0
dti_diffeomorphic_population mean_affine3.nii.gz subjs_aff.txt mask.nii.gz 0.002

Here are the errors:

inFile = diffeo.txt
outFile = mean_df.nii.gz
subject 1 : Post26/dti_scl_aff_diffeo.df.nii.gz
Reading Post26/dti_scl_aff_diffeo.df.nii.gz ... ** ERROR (nifti_image_read): failed to find header file for 'Post26/dti_scl_aff_diffeo.df.nii.gz'
Done in 0s
fail to load Post26/dti_scl_aff_diffeo.df.nii.gz
inFile = mean_df.nii.gz
Reading mean_df.nii.gz ... ** ERROR (nifti_image_read): failed to find header file for 'mean_df.nii.gz'
Done in 0s
fail to load mean_df.nii.gz
inFile = mean_diffeomorphic_initial6.nii.gz
outFile = mean_diffeomorphic_initial6.nii.gz
transFile = mean_df_inv.nii.gz
df option is FD
interpolation option is LEI
reorientOption = PPD
Reading mean_diffeomorphic_initial6.nii.gz ... Done in 0.08s
Reading mean_df_inv.nii.gz ... ** ERROR (nifti_image_read): failed to find header file for 'mean_df_inv.nii.gz'
Done in 0s
fail to load mean_df_inv.nii.gz
[Matlab@SBS1109 DTI_PostProcessing]$ dti_diffeomorphic_population mean_affine3.nii.gz subjsF_aff.txt ixi_aging_template_brain_mask.nii.gz 0.002^C

Best,
Molly


Hui Zhang

unread,
Oct 16, 2014, 1:22:50 PM10/16/14
to DTI ToolKit (DTI-TK)
Hi Molly,

The problem is that you have your data stored in one or more subfolders.

subject 1 : Post26/dti_scl_aff_diffeo.df.nii.gz
Reading Post26/dti_scl_aff_diffeo.df.nii.gz ... ** ERROR (nifti_image_read): failed to find header file for 'Post26/dti_scl_aff_diffeo.df.nii.gz'
Done in 0s
fail to load Post26/dti_scl_aff_diffeo.df.nii.gz

DTI-TK does not yet have the flexibility to support this.  All the data should be stored in a single directory.

Gary


--

---
You received this message because you are subscribed to the Google Groups "DTI-TK" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dtitk+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Roalf

unread,
Nov 5, 2014, 3:32:11 PM11/5/14
to dt...@googlegroups.com
Hi Gary, 

I am new to DTITK and it looks quite helpful, but I too am getting the same error as noted above by Molly. All of my data is in one directory (right now this is only two subjects, as a test case). I have followed your tutorial on the website to covert my data and perform the initial registration. However, the error persists. From the error messages it appears that the *aff_diffeo.df.nii.gz, mean_df.nii.gz, and mean_df_inv.nii.gz are not being created. I have tried it on several machines (including our SGE) and on several different datasets. I have also had a few other users who are very familiar with ANTS look at it to no avail.  Any help would be most appreciated!

I have run the following (FYI this data set includes children-thus an intial template was created):

TVMean -in subject.txt -out mean_initial.nii.gz
TVResample -in mean_initial.nii.gz -align center -size 128 128 64 -vsize 1.5 1.75 2.25
dti_rigid_population mean_initial.nii.gz subject.txt EDS 3
dti_affine_population mean_initial.nii.gz subject.txt EDS 3
TVtool -in mean affine3.nii.gz -tr
BinaryThresholdImageFilter mean_affine3_tr.nii.gz mask.nii.gz 0.01 100 1  (NOTE: I have found that the latest version of this binary does not work to create a mask--however I have used ANTS ThresholdImage to make the mask).
dti_diffeomorphic_population mean_affine3.nii.gz subject_aff.txt mask.nii.gz 0.002

As far as I can tell the rigid and affine registration steps run successfully.

Error:

inFile = diffeo.txt
outFile = mean_df.nii.gz
subject 1 : 109733_4372_dti_eddy_with_CNI_rotated_bvecs_dtitk_aff_diffeo.df.nii.gz
Reading 109733_4372_dti_eddy_with_CNI_rotated_bvecs_dtitk_aff_diffeo.df.nii.gz ... ** ERROR (nifti_image_read): failed to find header file for '109733_4372_dti_eddy_with_CNI_rotated_bvecs_dtitk_aff_diffeo.df.nii.gz'
Done in 0s
fail to load 109733_4372_dti_eddy_with_CNI_rotated_bvecs_dtitk_aff_diffeo.df.nii.gz
inFile = mean_df.nii.gz
Reading mean_df.nii.gz ... ** ERROR (nifti_image_read): failed to find header file for 'mean_df.nii.gz'
Done in 0s
fail to load mean_df.nii.gz
inFile = mean_diffeomorphic_initial1.nii.gz
outFile = mean_diffeomorphic_initial1.nii.gz
transFile = mean_df_inv.nii.gz
df option is FD
interpolation option is LEI
reorientOption = PPD
Reading mean_diffeomorphic_initial1.nii.gz ... Done in 0.07s
Reading mean_df_inv.nii.gz ... ** ERROR (nifti_image_read): failed to find header file for 'mean_df_inv.nii.gz'
Done in 0s
fail to load mean_df_inv.nii.gz



Best, 
David Roalf, Ph.D. 
Research Assistant Professor
University of Pennsylvania
Department of Psychiatry, Neuropsychiatry Section

Hui Zhang

unread,
Nov 6, 2014, 3:08:13 AM11/6/14
to dt...@googlegroups.com
Hi David,

A couple of things to check or try:

- Make sure all the input DTI volumes are gzipped NIfTI.

- If that doesn't fix the problem, try renaming the input volumes with shorter file names.  Start with something like subj1.nii.gz and subj2.nii.gz

Also, I highly recommend that you compile your own binary from source to keep up with recent updates.

Let me know how you get on.  We should be able to fix this.

Gary

David Roalf

unread,
Nov 6, 2014, 1:58:29 PM11/6/14
to dt...@googlegroups.com
Hi Gary, 

Thanks for your quick reply. Much appreciated. All of the input images are g-zipped NIFTI (*.nii.gz). I shortened the names to be "sub1" and "sub2". Problem persists:

I have attached the full log of all commands run and their verbose output.

If you have other suggestions I am certainly willing try other debug options! 


Thanks!
David



To unsubscribe from this group and stop receiving emails from it, send an email to dtitk+unsubscribe@googlegroups.com.
dtitk_roalf.rtf

Hui Zhang

unread,
Nov 6, 2014, 4:00:25 PM11/6/14
to dt...@googlegroups.com
Hi David,

The full log is very useful.  A number of issues emerged.

First, the reason that the diffeomorphic bit failed actually had nothing to do with a fault in the software.  Something else has gone wrong.  I suspect it is the mask.  Can you inspect the mask and make sure that it has the same NIFTI orientation information etc as the mean template?  Can you also send me the error from the built-in mask generator?

Second, after you run the rigid registration bits, you are supposed to use the mean_rigid3.nii.gz as the template for the next affine registration stage.

Gary

Philip A Cook

unread,
Nov 6, 2014, 4:06:56 PM11/6/14
to dt...@googlegroups.com
Hi all,

David, does the file

109733_4372_dti_eddy_with_CNI_rotated_bvecs_dtitk_aff_diffeo.df.nii.gz

really not exist? If not, do other diffeo.df.nii.gz files exist, or are they all missing?

I've had errors where one or two images fail to register. This messes up the template creation with an error message like the one you have. Fixing that registration by hand solves the issue.

If all the images aren't writing, it's probably something more systematic.

Also, do the files

109733_4372_dti_eddy_with_CNI_rotated_bvecs_dtitk_aff.log
109733_4372_dti_eddy_with_CNI_rotated_bvecs_dtitk_aff.err

exist? The contents of those might be helpful in diagnosing the problem.

Hui Zhang

unread,
Nov 6, 2014, 4:28:26 PM11/6/14
to DTI ToolKit (DTI-TK)
Phil is right.  These files (*diffeo.df.nii.gz) are not even created because the registration has "failed", although not technically.  For some reason, the registration thinks that the two images are already aligned.  One reason I mentioned previously is that the mask might have been at fault.  Alternatively, something might have gone wrong with the affine and/or rigid stages.  I can't emphasise more that one has to visually inspect the results from each stage to make sure things have worked as expected.

Gary

David Roalf

unread,
Nov 7, 2014, 11:56:40 AM11/7/14
to dt...@googlegroups.com
HI Phil & Gary, 

Thanks again for your prompt response. I am convinced that I am doing something simple incorrect. I just can't figure it out. 

To answer Phil's questions:
-It is usually the case that at least one diffeo.df.nii.gz is never created. At the completion of the latest attempt I see neither (just running on two subjects as a test). The first time I ran this on a larger set of data (14 subjects)-there were 13 of these files....so one was missing. 
-Not sure what you mean by "fixing the registration by hand"
-I have attached the *.log files from the latest attempt. The *.err files exist, but are empty..even though the Error I pasted above still prints to the screen and some files are never created.

To answer Gary's questions:
-When I run BinaryThresholdImageFilter I end up with a blank image. I have attached a screen shot of the output & header (from PrintHeader) from that mask. When I run ANTS ThresholdImage I end up with an exclusion mask (See attached). 
-I have created and looked at the output at each step (rigid, mean_rigid, affine, mean_affine) and all seems correct in those steps. I have attached a PDF of those images. Below is the list of what is included in the PDF

Page 1: trace maps from input data (sub1 and sub2) and the trace map of the TVMean step (mean initial)
Page 2: sub1 and sub 2 after rigid registration
Page 3:sub 1 and sub 2 after affine registration and mean _affine3_tr.nii.gz
Page 4:output mask of BinaryThresholdImageFilter and the input (mean_affine3_tr.nii.gz) 
Page 5: output mask of ANTs ThresholdImage


I apologize for the dump of information. Hopefully there is a clue inside as to what I am doing incorrectly .

Much appreciated!

Best, 
David
sub1_aff.log
sub2_aff.log
directory_after_diffeo.png
DTITK_roalf.pdf
Header_BinaryThresh_mask.png
Header_mean_affine3.png
Header_ANTS_mask.png

Philip A Cook

unread,
Nov 7, 2014, 12:22:08 PM11/7/14
to dt...@googlegroups.com
By register by hand I meant identifying the problem subject(s), removing any problems (bad headers, bad brain masking, etc) and running its registration independently with dti_rigid_reg and dti_affine_reg. Once there is a good affine registration for all subjects, you can carry on with the diffeomorphic population script.

As Gary suggested, you might benefit from changing your commands. When you do

dti_rigid_population mean_initial.nii.gz subject.txt EDS 3

The volumes are rigidly aligned to mean_rigid3.nii.gz, but then you do

dti_affine_population mean_initial.nii.gz subject.txt EDS 3

Now you're initializing a registration to mean_initial with a transformation that maps images to mean_rigid3. This might cause one or more subjects to not converge properly.

I would try

dti_rigid_population mean_initial.nii.gz subject.txt EDS 3
dti_affine_population mean_rigid3.nii.gz subject.txt EDS 3

Then compute FA for each subject_aff.nii.gz and check alignment.


The mask problem is strange, it looks like you created a 2D mask somehow. Maybe you accidentally did

ThresholdImage 2 ...

instead of

ThresholdImage 3

As to the blank image, I can't diagnose too much without access to mean_affine_tr.nii.gz, but the presence of NaNs in the image are a possible culprit.
> <sub1_aff.log><sub2_aff.log><directory_after_diffeo.png><DTITK_roalf.pdf><Header_BinaryThresh_mask.png><Header_mean_affine3.png><Header_ANTS_mask.png>

David Roalf

unread,
Nov 7, 2014, 3:44:54 PM11/7/14
to dt...@googlegroups.com
Thanks Phil, 

I think I figured out the problem.

For the latest try I did implement the commands that you and Gary suggested. I don't think this was the issue. I think it is, as Gary had surmised, a mask issue. 

Using the logic on the DTITK registration documentation page for BinaryThresholdImageFilter it creates an 'exclusion mask', where I think it should be an inclusion mask (e.g. brain mask). This could be simple confusion b/w ANTS and DTITK (outside/inside are switched in each call). It is possible that I am just unclear on the BinaryThresholdImageFilter command.

The Command listed on the website is:  "BinaryThresholdImageFilter mean_affine3_tr.nii.gz mask.nii.gz 0.01 100 1 0"

My understanding from the Usage printout for the current binary I have:
>>>>>>>>
roalf@pons: BinaryThresholdImageFilter

Usage: BinaryThresholdImageFilter inputImageFile outputImageFile  lowerThreshold upperThreshold  outsideValue insideValue 
>>>>>>>>

The values of my data (mean_affine3_tr) range from 0.003 (outside of the brain) to ~6 in CSF. Thus, I think running the command as listed creates a mask of 1's outside the brain (lower than 0.01 since the outside value = 1; image included in last PDF I sent) and 0's inside the brain. I think my logic here is correct?

I think the call should be:
BinaryThresholdImageFilter mean_affine3_tr.nii.gz mask.nii.gz 0.01 100 0 1  (last two inputs are switched). Thus making 1's where values are between 0.01 and 1, which result in a brain mask. 

However, my version of BinaryThresholdImageFilter does not work. Thus, substituting ANTs ThresholdImage 3 mean_affine3_tr.nii.gz mask.nii.gz 0.01 100 1 0 creates a brain mask, not an exclusion mask (previously, I was sticking to the BinaryThresholdImageFilter command as I understood it (outside =1, inside = 0).

Using this brain mask, dti_diffeomorphic_population appears to run without error. Clearly, it makes more sense to me to use a brain mask and not an exclusion mask, guess I should have just asked this up front. 

Sorry for all of the back and forth, but I appreciate all of the responses. 

Best, 
David

Hui Zhang

unread,
Nov 8, 2014, 4:53:27 PM11/8/14
to DTI ToolKit (DTI-TK)
Hi David,

I am glad you figured this out.  Here is the most bizarre thing.  The BinaryThresholdImageFilter that shipped with DTI-TK should give the following usage information:

[gzhang@CMICAir visual]$BinaryThresholdImageFilter 

Usage: 

BinaryThresholdImageFilter inputImage outputImage lower upper inside outside


So I can conclude that the version you run, despite the name, can't be the same as the one from DTI-TK.  Can you please use "which BinaryThresholdImageFilter" to confirm if you are using the copy from DTI-TK or not?

Thanks.

Gary

David Roalf

unread,
Nov 13, 2014, 4:13:44 PM11/13/14
to dt...@googlegroups.com
Thanks Gary

The usage statement as printed from BinaryThresholdImageFilter (InsightToolkit-4.6.1) as installed on our system is (which is clearly wrong):

Usage: BinaryThresholdImageFilter inputImageFile outputImageFile  lowerThreshold upperThreshold  outsideValue insideValue

Clearly that was the problem. Thanks for all of your help. 

David

Hui Zhang

unread,
Nov 14, 2014, 6:57:53 AM11/14/14
to DTI ToolKit (DTI-TK)
Thanks for the update David.

Very glad we can track down this problem which I have never anticipated!

Gary

Kayti Thorn

unread,
Apr 22, 2020, 7:54:19 AM4/22/20
to DTI-TK
Hello all,

I was having a similar problem as the one Molly and David described above. My processing steps are as follows:

TVMean -in subjs.txt -out mean_initial.nii.gz

TVResample -in mean_initial.nii.gz -align center -size 128 128 64 -vsize 1.5 1.75 2.25
dti_template_bootstrap ixi_aging_template.nii.gz subjs.txt
dti_rigid_population mean_initial.nii.gz subjs.txt EDS 3
dti_affine_population mean_rigid3.nii.gz subjs.txt EDS 3

TVtool -in mean_affine3.nii.gz -tr
BinaryThresholdImageFilter mean_affine3_tr.nii.gz mask.nii.gz 0.01 100 1 0
dti_diffeomorphic_population mean_affine3.nii.gz subjs_aff.txt mask.nii.gz 0.002

No errors or warnings are returned by any command until I get to dti_diffeomorphic_population. This command runs as expected up through the creation of mean_diffeomorphic_initial_6.nii.gz, but then returns the following errors:

inFile = diffeo.txt
outFile = mean_df.nii.gz
subject 1 : Subj1_aff_diffeo.df.nii.gz
Reading Subj1_aff_diffeo.df.nii.gz ... ** ERROR (nifti_image_read): failed to find header file for 'Subj1_aff_diffeo.df.nii.gz'
Done in 0.000109s
fail to load Subj1_DT_p_aff_diffeo.df.nii.gz

inFile = mean_df.nii.gz
Reading mean_df.nii.gz ... ** ERROR (nifti_image_read): failed to find header file for 'mean_df.nii.gz'
Done in 8.8e-05s

fail to load mean_df.nii.gz
inFile = mean_diffeomorphic_initial6.nii.gz
outFile = mean_diffeomorphic_initial6.nii.gz
transFile = mean_df_inv.nii.gz
df option is FD
interpolation option is LEI
reorientOption = PPD
Reading mean_diffeomorphic_initial6.nii.gz ... Done in 0.064757s

Reading mean_df_inv.nii.gz ... ** ERROR (nifti_image_read): failed to find header file for 'mean_df_inv.nii.gz'
Done in 0.000111s
fail to load mean_df_inv.nii.gz

No [subj]_diffeo.df.nii.gz, mean_df.nii.gz, nor mean_df_inv.nii.gz files are created.

All of my files are in the same folder. Rigid and affine alignments work fine. I check the quality of the registration between steps and it looks as expected. The mask creation also works as expected.

Does anyone have any idea what might be happening here?

Thank you!
-Kayti Keith
To unsubscribe from this group and stop receiving emails from it, send an email to dt...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages