Fixelcfestats error with DICOM images

Hi Everyone,

I was following the tutorial for fixel based analysis of fibre density.

http://mrtrix.readthedocs.io/en/latest/fixel_based_analysis/mt_fibre_density_cross-section.html?

I have also looked at this post http://community.mrtrix.org/t/fixelcfestats-error-no-dicom-images/908/5

But reposting here.

I am getting the following error for fixelcfestats in the final step

I have the following files in my files.txt No spaces or extra lines present
HC03.mif
HC04.mif
HC05.mif

I have ran the command with -debug option; and get the following description (note: only part of an extremely long debug message displayed here)

fixelcfestats: [DEBUG] memory-mapping file "fd/index.mif"...
fixelcfestats: [DEBUG] file "fd/index.mif" mapped at 0x7ffab083a000, size 10770252 (read-only)
fixelcfestats: [DEBUG] DICOM magic number not found in file "fd/index.mif" - trying truncated format
fixelcfestats: [DEBUG] file "fd/index.mif" does not have the DICOM magic number or the .dcm extension - assuming not 
DICOM
fixelcfestats: [DEBUG] unmapping file "fd/index.mif"
fixelcfestats: [INFO] error reading file "fd/index.mif" - ignored
fixelcfestats: [.   ] scanning DICOM folder "fd/"... 
fixelcfestats: [DEBUG] memory-mapping file "fd/directions.mif"...
fixelcfestats: [DEBUG] file "fd/directions.mif" mapped at 0x7ffab17be000, size 2607012 (read-only)
fixelcfestats: [DEBUG] DICOM magic number not found in file "fd/directions.mif" - trying truncated format
fixelcfestats: [DEBUG] file "fd/directions.mif" does not have the DICOM magic number or the .dcm extension - 
assuming  not DICOM
fixelcfestats: [DEBUG] unmapping file "fd/directions.mif"
fixelcfestats: [INFO] error reading file "fd/directions.mif" - ignored
fixelcfestats: [DEBUG] memory-mapping file "fd/HC03.mif"...
fixelcfestats: [DEBUG] file "fd/HC03.mif" mapped at 0x7ffab50d1000, size 886916 (read-only)
fixelcfestats: [DEBUG] DICOM magic number not found in file "fd/HC03.mif" - trying truncated format
fixelcfestats: [DEBUG] file "fd/HC03.mif" does not have the DICOM magic number or the .dcm extension - assuming not 
DICOM
fixelcfestats: [DEBUG] unmapping file "fd/HC03.mif"
fixelcfestats: [INFO] error reading file "fd/HC03.mif" - ignored
fixelcfestats: [DEBUG] memory-mapping file "fd/HC04.mif"...
fixelcfestats: [DEBUG] file "fd/HC04.mif" mapped at 0x7ffab50d1000, size 886916 (read-only)
fixelcfestats: [DEBUG] DICOM magic number not found in file "fd/HC04.mif" - trying truncated format
fixelcfestats: [DEBUG] file "fd/HC04.mif" does not have the DICOM magic number or the .dcm extension - assuming not 
DICOM
fixelcfestats: [DEBUG] unmapping file "fd/HC04.mif"
fixelcfestats: [INFO] error reading file "fd/HC04.mif" - ignored
fixelcfestats: [DEBUG] memory-mapping file "fd/HC05.mif"...
fixelcfestats: [DEBUG] file "fd/HC05.mif" mapped at 0x7ffab50d1000, size 886916 (read-only)
fixelcfestats: [DEBUG] DICOM magic number not found in file "fd/HC05.mif" - trying truncated format
fixelcfestats: [DEBUG] file "fd/HC05.mif" does not have the DICOM magic number or the .dcm extension - assuming not 
DICOM
fixelcfestats: [DEBUG] unmapping file "fd/HC05.mif"
fixelcfestats: [INFO] error reading file "fd/HC05.mif" - ignored
fixelcfestats: [done] scanning DICOM folder "fd/"
fixelcfestats: [done] validating input files
fixelcfestats: [DEBUG] deleting scratch buffer for image "scratch fixel mask"...
fixelcfestats: [DEBUG] image "scratch fixel mask" unloaded
fixelcfestats: [DEBUG] unmapping file "fd/index.mif"
fixelcfestats: [DEBUG] image "fd/index.mif" unloaded
fixelcfestats: [ERROR] no DICOM images found in "fd/"
fixelcfestats: [ERROR] error opening image "fd/"

Has anyone solved for this ?

Kind regards

@isAarya: can you post the exact command you used? I have a feeling the documentation is not up to date…

@rsmith, @ThijsDhollander: the current documentation page for fixelcfestats states that it needs 6 arguments, with the first one being the input fixel folder. Yet the current FBA instructions being followed here show it being used with only 5 arguments, where the first one is the list of subject filenames. This doesn’t sound right… (?)

This is the command that I have used

fixelcfestats fd files.txt design.txt contrast.txt tracks_sift.tck stats_fd

where directory fd contains the directions.mif, index.mif, HC03.mif, HC04.mif and HC05.mif

Ok, that looks correct. Another possibility is that you might be running an older version of fixelcfestats. What does fixelcfestats -version report?

Hi,

The version information is

fixelcfestats -version
== fixelcfestats 3.0_RC2-7-g4ed6d5ef ==
64 bit release version, built Aug 21 2017, using Eigen 3.2.92
Author(s): David Raffelt (david.raffelt@florey.edu.au) and Robert E. Smith (robert.smith@florey.edu.au)
Copyright (c) 2008-2017 the MRtrix3 contributors.

This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, you can obtain one at http://mozilla.org/MPL/2.0/.

The key debug message is this one:

scanning DICOM folder "fd/"...

All MRtrix3 commands are compatible with all image formats that the MRtrix3 back-end is compatible with. It determines the image format based on the file extension of the path to the image. In the case where the path does not contain a file extension, MRtrix3 assumes that it must be a path to a DICOM folder, and tries to read the input image in that way. You can see this subsequently failing.

What I’ve seen produce this problem with fixelcfestats in the past is the presence of an empty line at the end of the text file containing the names of the subject data files. The code must produce the full path to the subject’s file by concatenating the template fixel directory path with the image file name; when the latter is an empty string, the result of that concatenation is just the template fixel directory, and hence the path to the template fixel directory is interpreted as “a subject fixel data file to be opened”, triggering the quoted errors.

So closely check this text file for the presence of an empty line at the end of the file. If there’s none present, try not even having a newline at the end of the last subject line (from memory the text file load in fixelcfestats may have had a little error in logic, which could result in trying to interpret an empty string as a file path).

I’ve fixed this in a development branch, where importing of data for statistical inference is completely overhauled, but it’s not yet ready for public consumption. If this is indeed the cause of grief now, it’s probably worth pushing out a hotfix.

Yet the current FBA instructions being followed here show it being used with only 5 arguments, where the first one is the list of subject filenames.

No, it’s right:

fixelcfestats fd files.txt design_matrix.txt contrast_matrix.txt input_tracks_2_million_sift.tck stats_fd

“fd” is the path to the template fixel directory. files.txt is hence the second argument.

Rob

:confused: I think I’m losing the plot… I must have been looking at an older version of the docs or something. Ignore me…

Hi, I recently ended up running into similar error when using fixelcfestats with -mask option.

bash-4.2$ fixelcfestats fd_smooth/ stats_new/files/files_${letter}/${i}.txt stats_new/design_matrix/design_matrix_${letter}/${i}.txt stats_new/contrast_matrix.txt matrix/ stats_new/stats_fd_${i}/ -mask ${Save_Dir}/Not_Subject_Data/SEEG_and_resection/Resection_masks/Resection_masks_template_space/fixel_masks/${i}_fixel_mask -debug
fixelcfestats: [DEBUG] No config file found at "/etc/mrtrix.conf"
fixelcfestats: [DEBUG] No config file found at "/home/fmri/montilla/.mrtrix.conf"
fixelcfestats: [INFO] opening image "fd_smooth/index.mif"...
fixelcfestats: [DEBUG] reading key/value file "fd_smooth/index.mif"...
fixelcfestats: [DEBUG] sanitising image information...
fixelcfestats: [INFO] image "fd_smooth/index.mif" opened with dimensions 199x192x139x2, voxel spacing 1.25x1.25x1.25x9, datatype UInt32LE
fixelcfestats: [DEBUG] memory-mapping file "fd_smooth/index.mif"...
fixelcfestats: [DEBUG] file "fd_smooth/index.mif" mapped at 0x7f719ae98000, size 42487296 (read-only)
fixelcfestats: [DEBUG] image "fd_smooth/index.mif" loaded
fixelcfestats: [DEBUG] image "fd_smooth/index.mif" initialised with strides = [ -2 398 76416 1 ], start = 396, using direct IO
fixelcfestats: Number of fixels in template: 598011
fixelcfestats: [INFO] opening image "/cluster/projekty/pokrocileEPI/NL_EPI_DWI/version_full_preproc/Not_Subject_Data/SEEG_and_resection/Resection_masks/Resection_masks_template_space/fixel_masks/384A_fixel_mask"...
fixelcfestats: [DEBUG] memory-mapping file "/cluster/projekty/pokrocileEPI/NL_EPI_DWI/version_full_preproc/Not_Subject_Data/SEEG_and_resection/Resection_masks/Resection_masks_template_space/fixel_masks/384A_fixel_mask/directions.mif"...
fixelcfestats: [DEBUG] file "/cluster/projekty/pokrocileEPI/NL_EPI_DWI/version_full_preproc/Not_Subject_Data/SEEG_and_resection/Resection_masks/Resection_masks_template_space/fixel_masks/384A_fixel_mask/directions.mif" mapped at 0x7f719f5f0000, size 172540 (read-only)
fixelcfestats: [DEBUG] DICOM magic number not found in file "/cluster/projekty/pokrocileEPI/NL_EPI_DWI/version_full_preproc/Not_Subject_Data/SEEG_and_resection/Resection_masks/Resection_masks_template_space/fixel_masks/384A_fixel_mask/directions.mif" - trying truncated format
fixelcfestats: [DEBUG] file "/cluster/projekty/pokrocileEPI/NL_EPI_DWI/version_full_preproc/Not_Subject_Data/SEEG_and_resection/Resection_masks/Resection_masks_template_space/fixel_masks/384A_fixel_mask/directions.mif" does not have the DICOM magic number or the .dcm extension - assuming not DICOM
fixelcfestats: [DEBUG] unmapping file "/cluster/projekty/pokrocileEPI/NL_EPI_DWI/version_full_preproc/Not_Subject_Data/SEEG_and_resection/Resection_masks/Resection_masks_template_space/fixel_masks/384A_fixel_mask/directions.mif"
fixelcfestats: [INFO] error reading file "/cluster/projekty/pokrocileEPI/NL_EPI_DWI/version_full_preproc/Not_Subject_Data/SEEG_and_resection/Resection_masks/Resection_masks_template_space/fixel_masks/384A_fixel_mask/directions.mif" - ignored
fixelcfestats: [.   ] scanning DICOM folder "/cluster/p...fixel_masks/384A_fixel_mask"...
fixelcfestats: [DEBUG] memory-mapping file "/cluster/projekty/pokrocileEPI/NL_EPI_DWI/version_full_preproc/Not_Subject_Data/SEEG_and_resection/Resection_masks/Resection_masks_template_space/fixel_masks/384A_fixel_mask/index.mif"...
fixelcfestats: [DEBUG] file "/cluster/projekty/pokrocileEPI/NL_EPI_DWI/version_full_preproc/Not_Subject_Data/SEEG_and_resection/Resection_masks/Resection_masks_template_space/fixel_masks/384A_fixel_mask/index.mif" mapped at 0x7f7198610000, size 42488560 (read-only)
fixelcfestats: [DEBUG] DICOM magic number not found in file "/cluster/projekty/pokrocileEPI/NL_EPI_DWI/version_full_preproc/Not_Subject_Data/SEEG_and_resection/Resection_masks/Resection_masks_template_space/fixel_masks/384A_fixel_mask/index.mif" - trying truncated format
fixelcfestats: [DEBUG] file "/cluster/projekty/pokrocileEPI/NL_EPI_DWI/version_full_preproc/Not_Subject_Data/SEEG_and_resection/Resection_masks/Resection_masks_template_space/fixel_masks/384A_fixel_mask/index.mif" does not have the DICOM magic number or the .dcm extension - assuming not DICOM
fixelcfestats: [DEBUG] unmapping file "/cluster/projekty/pokrocileEPI/NL_EPI_DWI/version_full_preproc/Not_Subject_Data/SEEG_and_resection/Resection_masks/Resection_masks_template_space/fixel_masks/384A_fixel_mask/index.mif"
fixelcfestats: [INFO] error reading file "/cluster/projekty/pokrocileEPI/NL_EPI_DWI/version_full_preproc/Not_Subject_Data/SEEG_and_resection/Resection_masks/Resection_masks_template_space/fixel_masks/384A_fixel_mask/index.mif" - ignored
fixelcfestats: [done] scanning DICOM folder "/cluster/p...fixel_masks/384A_fixel_mask"
fixelcfestats: [DEBUG] unmapping file "fd_smooth/index.mif"
fixelcfestats: [DEBUG] image "fd_smooth/index.mif" unloaded
fixelcfestats: [ERROR] no DICOM images found in "/cluster/projekty/pokrocileEPI/NL_EPI_DWI/version_full_preproc/Not_Subject_Data/SEEG_and_resection/Resection_masks/Resection_masks_template_space/fixel_masks/384A_fixel_mask"
fixelcfestats: [ERROR] error opening image "/cluster/projekty/pokrocileEPI/NL_EPI_DWI/version_full_preproc/Not_Subject_Data/SEEG_and_resection/Resection_masks/Resection_masks_template_space/fixel_masks/384A_fixel_mask"
  • without mask it runs OK
  • my *.txt files does not have an empty lines and running file files_${letter}/${i}.txt resulted in : ASCII text answer.
  • I checked dimensions and voxel size for mask and template a few times and it is the same. I also inspected mask visually and it looks like a fixel mask to me (template, over it - template fixel mask in red, over it - my fixel mask)

masks were produced using fod2fixel with -fmls_peak_value 0.06, binary voxel mask and wmfod_template.mif as input and fixel_mask folder as an output

My fixelcfestats version is

Have anybody encountered this error before?

Thanks for your help.

For everybody who will in a future struggle with a same issue and will open this thread :slight_smile:

Masks need to be generated using command
voxel2fixel, with mask as an input image and e.g. fd folder as fixel_directory_in and ideally also also fixel_directory_out (so you won’t end up with duplicated index.mif and direction.mif files).

This is because of the way how fixel data are stored.
The first 3D volume in the 4th dimension stores the number of elements (fixels) per voxel.
Second volume of index.mif file stores the index of the first element (fixel) in that voxel; indices for the subsequent elements in each voxel are inferred to be sequential.
(e.g. Index number 1 corresponds to the first fixel in a direction.mif file, etc.)

When creating fixel masks using fod2fixel, resulting masks won’t correspond to the sequencing system of fixels in a second volume of index.mif file. Therefore it will result in an error.

(more info here)

Thanks for the help to @jdtournier.

1 Like