Dimon - "failed to read ... .IMA as dicom"

I am using Dimon to convert a long list (per subject) of anatomical and functional .IMA files to AFNI’s .BRIK and .HEAD format. This works without an issue for the anatomical and resting-state .IMA files.

Problem:
The problem arises in a couple (not all!) of subjects for the functional task runs (also in .IMA format). More precisely, Dimon fails to read some of the .IMA files. It prints the following message:

53%* failed to read file '/volumes/sandisk/fmri/Dataset.../LRH_LIXIYING_001.MR.PKU_ALL_LIURONGHAN.0004.0391.2024.11.13.20.28.34.478701.1097106061.IMA' as dicom*

Hence, the problem occurs for some of the .IMA files in some subjects, but not for all .IMA files.
Moreover, Dimon still creates the +orig.BRIK.gz and +orig.HEAD files even in subjects where some .IMA files could apparently not be read. These final output files look normal to me when I open them with the AFNI GUI.

Here is the relevant part of my code

Dimon \
		-infile_prefix $dir_in2/$file_func \
		-dicom_org \
		-GERT_Reco \
		-gert_create_dataset \
		-gert_to3d_prefix ${run}_${subj} \
		-assume_dicom_mosaic \
		-use_obl_origin \
		-gert_outdir $dir_out \
		-save_details $dir_out/Details

Questions:

  1. What happens to the single .IMA files that could not be read? Do my final .BRIK+HEAD files miss data, such as single sampling points?
  2. How can I approach this problem, is there an initial or first step to solve this problem?

Thanks you.

Is dicom_hdr able to read that file? You don't have to post the long text output, but does it show valid output, or does it report a failure?

Thanks,

-rick

Hi,

you are right, this is the issue. It appears that some of the .IMA files are corrupted. Here is an example. The functional task run of one subject has 720 .IMA files. Dimon reports the error, as stated in my first post, for 6 of these files, and then 5 of those files in an additional processing step called "scanning for additional volumes...".

Now, using dicom_hdr results in the following error for exactly those files (see the error message below for one of those files).


*** ERROR: can't open CMJ.MR.PKU_ALL_LP.0005.0402.2024.09.26.22.33.41.800601.1007333050.IMA as a DICOM file!


Is there a way to solve this, or are the affected .IMA files forever lost/destroyed? How does it affect the construction of the functional run?

Update:
The issue is solved. There was an issue when I copied the .IMA files to an external SSD, I think. The affected files were somehow not copied correctly, hence the issue discussed here arose. Copy+pasting them again solved the problem. Sorry, silly mistake.

That's great news!

Yes, sometimes when copying to external devices it helps to run a couple of 'sync' commands before ejecting them, just to encourage the writing to complete, and being more sure that it has (sync may sit and wait for writing to finish).

Thanks for the update,

-rick