Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dcmstach support for multi-EPI #28

Closed
TheChymera opened this issue Apr 2, 2015 · 8 comments
Closed

dcmstach support for multi-EPI #28

TheChymera opened this issue Apr 2, 2015 · 8 comments

Comments

@TheChymera
Copy link

I am using dcmstack via its nipype interface. I have reported my issues here, and it seems my problem stems from dcmstack not being able to deal with multi-EPI DICOMs automatically. As stated in the linked issue report, dcmstack works nicely with my anatomical DICOMS, for instance.

How can I do the conversion for my multi-EPIs with your software?

@TheChymera
Copy link
Author

@moloney no ideas?

@moloney
Copy link
Owner

moloney commented Apr 20, 2015

Sorry for the long delay.

So your data is 5D? The dcmstack code can usually guess how to sort the 4th dimension, but it doesn't even try to guess with higher dimensions. You would need to specify how to sort the 4th and 5th dimensions (e.g. using 'AcquisitionTime' and 'EchoTime'). If you are still stuck, maybe you can share the data?

@TheChymera
Copy link
Author

Many thanks for the offer to hep me out :) I also wouldn't mind sharing the data, but I seem to have figured it out. I have built in an automated check for multi-echo images in my currently emerging script.

I am unsure how easy it would be to implement smething similar in dcmstack, but I think it would be nice if it could handle multi-EPI data natively. The logic behnd the check is very simple (and imho without any notable exception cases): if you have multiple EPI times, you should stack along that dimension.

@moloney
Copy link
Owner

moloney commented Apr 27, 2015

Could you confirm that your data is 5D?

I don't see how your script could help, dcmstack is still going to re-sort the input dicom files. You need to set the 'time_order' and 'vector_order' when creating the DicomStack object so that it knows how to sort the 4th and 5th dimensions (i.e. set this to 'AcquisitionTime' and 'EchoTime' or vice versa).

I just noticed the nipype interface lacks these options, but that would be relatively easy to fix.

@TheChymera
Copy link
Author

@moloney I have 3600 DICOM files per trial:

600 repetitions X 20 slices X 3 echo times - as the DICOM files represent 2D maps, that makes my data 5D, right?

I don't think I understand this:

dcmstack is still going to re-sort the input dicom files

I am currently getting one (4D) file for each echo time (which is what I believe I need for AFNI's meica.py script for multi-echo imaging). Are you trying to describe hoe I can get dcmstack to output one 5D NifTi?

@moloney
Copy link
Owner

moloney commented Apr 27, 2015

Yes your data is 5D then.

If you want to get one 4D output for each echo time you could use the parse_and_stack function (https://github.com/moloney/dcmstack/blob/master/src/dcmstack/dcmstack.py#L1124) and include 'EchoTime' in the group_by tuple. By default the files are basically grouped by DICOM series.

Alternatively you could use time_order and vector_order to get a single 5D Nifti result, but it sounds like you don't want that.

Anyway, this isn't a bug in dcmstack. Trying to guess the 4th dimension is already somewhat tricky, but it is a common enough need that I think it is worthwhile. Trying to guess the desired 5D order (or how to group into multiple 4D outputs) is just not worth it. I would rather provide an informative error message and the ability to get the desired result by setting some basic parameters.

@moloney moloney closed this as completed Apr 27, 2015
@TheChymera
Copy link
Author

Thanks again for the helpful info. But I guess there is no easy way to do this with nipype?

I had a look over here and I couldn't really say how the interface could be extended to allow group_by or time_order/vector_order. Would you have any idea how to do it?

@TheChymera
Copy link
Author

@moloney How can I control where parse_and_stack writes my output?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants