to3d file order issue

I recently was trying to use to3d and noticed although the DICOM files appear to be in order in the data folder, to3d is not keeping the same ordering. For reference, it is going from file -2-1-.dcm to -2-10-.dcm to -2-100-.dcm instead of -2-1-.dcm to -2-2-.dcm.

I have tried replacing all the - with . but that did not have an effect. So far am not aware of an to3d option that currently exists to solve this problem.

Wondering what a solution to this problem might be.

Thanks!

Brooke

Hi Brooke,

Note that the alphabetical ordering should be 1- 10- 100- 101- 102- … 109- 11- 110- 111- … 200- … 2xx-
That is because ‘-’ comes before ‘0’. So this does not match numerical ordering.

Try using Dimon and asking it to do the sorting:

Dimon -infile_pattern ‘*.dcm’ -gert_create_dataset -dicom_org -save_details DET

Then you can look at the DET* files (the last one, probably) to see how it is sorting.
There are options for sorting on various keys.

  • rick

Ah ok, did not realize ‘-’ was technically before alphabetically.

I tried the command you suggested and the output DET final list file appeared to have sorted the files correctly. But when looking at the images in the afni gui, the x and y directions are extremely stretched, thus the problem seems to still persist. In case it matters, this only seems to happen when inputting the anatomical scan DICOM images and there are no issues with Dimon or to3d when inputting the EPI images.

Another brief note, is we were able to solve the problem by using the dcm2niix function.

Glad you have it working.

Stretching sounds like a problem with the dimensions within the DICOM files.
Would you please do one more test by adding -use_last_elem to the Dimon command?

Thanks,

  • rick

I tried adding -use_last_element and the images still appear stretched.

Thanks,

Brooke

Hi Brooke,

If you are happy with dcm2niix, that is great. But if you would like to investigate the stretching via Dimon, it is probably necessary for me to get a hold of some of the data. In that case, we should move the discussion to email. Just let me know if you would like to proceed with that, it is totally up to you. No pressure either way.

Thanks,

  • rick