Closed cbedetti closed 7 years ago
Hi cbedetti, did dcm2niix from this commit 3f2d477 work for you?
The double free or corruption
error has just been fixed. But it's still not ready to convert ecat7 images, since convertForeignToNifti
is not implemented yet, only hdr is read so far.
dcm2niix does not support ECAT7. The master development branch has some code which attempts to read the ECAT header, as part of an experimental attempt to read ECAT7. For the moment, you can use either the legacy dcm2nii or SPM12 to convert ECAT to NIfTI. However, be aware that neither of those tools convert the spatial transform (SForm). This means that spatial orientation may be wrong and different scans from the same session may not be aligned with each other. ECAT is a proprietary format, and it is unclear to me if we can fully support conversion to the NIfTI standard. Can your system also export to DICOM? If so, I would suggest following that route.
With the last version (dfce355491595891585576bfa351788244e9d848), I have this message now ECAT images not yet supported
^^
I tried 3f2d477c97df49f2a237673b7c235efcc0aadd56 and still have double free or corruption
error.
I know DICOM would be better but in this case it's not possible. To be more precise, dcm2nii
is successful in creating the NIfTI file but I still need to manually crop, transform 3D to 4D... So I tried dcm2niix !
If you plan to go futher with ECAT images, I would be happy to give feedbacks with the data I have.
You can try the latest build, but this is a feature I have just started working on. As I mentioned previously, for at least the near term I would recommend using SPM12 or dcm2nii. After further exploration, it seems like ECAT files do not fill in their "matrix" parameters, so it is impossible to accurately gauge the spatial orientation. I do not have access to an ECAT machine, but I would suggest that you work with your vendor to have them support a well documented format (NIfTI or DICOM) directly. The ECAT format as generated is simply underspecified to create a good NIfTI image.
In terms of your manually cropping and transforming from 3D to 4D, you may want to look at my Matlab scripts that use SPM12 to crop images - it might take a bit of tweaking for your data, but this should allow you to integrate all the steps. https://github.com/rordenlab/spmScripts/blob/master/nii_setOrigin12x.m
I have added experimental support for ECAT to dcm2niix v1.0.20170428, perhaps @chrisfilo and @cbedetti can try this out. I do have a few comments:
1.) ECAT files do not appear to store series numbers, so think carefully about how you specify the output filename (using -f
), for the OASIS data, I have found ./dcm2niix -f %n_%i -b n -v y ~/ECAT/
works pretty well.
2.) None of the ECAT files I have seen fill out the spatial transformation matrix, so I simply cloned SPM's approach for this. I do think it might be useful to ensure we are never flipping any dimensions (especially left-right flips).
3.) ECAT images can report separate scl_slopes for every volume in a 4D series. This is not possible for NIfTI 4D data. SPM12's solution is to save each volume as a separate 3D file. My solution is to convert the 16-bit data to 32-bit float and save the scaled image data. While my solution does create a single file and preserve precision, these files require twice as much disk space. I only do this if the scl_slope varies, so in theory some datasets will be converted to their native 16-bit and others will be saved as 32-bit.
4.) I have added a few preliminary BIDS features. Maybe someone who knows more about these modalities can attempt to support the proposed BIDS PET extension. Matlab users will find Flemming Hermansen's ecatfile.m an easy way to explore ECAT headers. In addition, developers and users may want to check out the dedicated ecat2nii.
Thank you for all the feed back and implementation you've done.
Just a minor bug. When I give several directories to dcm2niix, if one of the directory has only ECAT file, I get an error. The ECAT file is converted but dcm2niix won't look into the other directories even if there is DICOMs.
$ dcm2niix -b y -ba y -z y -f '%f_%p_%t_%s' -o tmp_dcm2bids/dcm2niix-example/ sourcedata/${sub}/*v00*/
Chris Rorden's dcm2niiX version v1.0.20170429 GCC4.4.7 (64-bit Linux)
Warning: ECAT support VERY experimental (Spatial transforms unknown)
Saving ECAT as 'tmp_dcm2bids/dcm2niix-example/${sub}_v00_*'
compress: "/usr/bin/pigz" -n -f "tmp_dcm2bids/dcm2niix-example/${sub}_v00_*.nii"
Error: Unable to find any DICOM images in sourcedata/${sub}/${sub}_v00_fdg
It's really easy to get around with iteration though.
I can not replicate your error. Are you sure there are DICOM files in the other folders and that the expansion for the ${sub} value is correct - in other words does it find the DICOM files if you explicitly provide a root folder that contains both DICOM and ECAT files. Below is my attempt to replicate your issue, where the root folder ~\tst_t1 contains both ECAT images (in ~\tst_t1\ECAT) as well as DICOM images (in ~\tst_t1\T1_simple_rorden)
./dcm2niix -b y -ba y -z y -f '%f_%p_%t_%s' -o ~/tst ~/tst_t1
Chris Rorden's dcm2niiX version v1.0.20170429 GCC6.1.0 (64-bit MacOS)
Warning: ECAT support VERY experimental (Spatial transforms unknown)
Saving ECAT as '/Users/rorden/tst/tst_t1__19770703150928_1'
compress: "/usr/local/bin/pigz" -n -f "/Users/rorden/tst/tst_t1__19770703150928_1.nii"
Warning: ECAT support VERY experimental (Spatial transforms unknown)
Saving ECAT as '/Users/rorden/tst/tst_t1_OAS30001_PIB_19770703150928_1'
compress: "/usr/local/bin/pigz" -n -f "/Users/rorden/tst/tst_t1_OAS30001_PIB_19770703150928_1.nii"
Found 176 DICOM image(s)
Convert 176 DICOM as /Users/rorden/tst/tst_t1__tfl3d1_ns_20080617133857_2 (256x256x176x1)
compress: "/usr/local/bin/pigz" -n -f "/Users/rorden/tst/tst_t1__tfl3d1_ns_20080617133857_2.nii"
Conversion required 1.341202 seconds (0.282014 for core code).
I was in a case where my script gave several input directories to dcm2niix with :
./dcm2niix -b y -ba y -z y -f '%f_%p_%t_%s' -o ~/tst ~/tst_v00_*
expand to
./dcm2niix -b y -ba y -z y -f '%f_%p_%t_%s' -o ~/tst ~/tst_v00_fdg ~/tst_v00_mr
Sorry about that, it was a PEBKAC bug ...
I'm converting ecat7 pet scans files.
dcm2nii
convert my files without error.Here is the output with
dcm2niix
build from this version:Not sure what's wrong here