-
Notifications
You must be signed in to change notification settings - Fork 59
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
convert to pydra #291
Comments
some context: output from the script is
and folder structure:
but the uc/*/*nii/ are empty. |
you have an issue when trying to convert to pydra, or you're not able to run with |
from pydra perspective, i'd like to convert it w/ pydra task/workflow to get a hang of it for the script specifically, only nipype.interfaces.dcm2nii was used but the result is unexpected. so as a side question, any suggestion from nipype guru would be appreciated. |
not sure what do you mean that results are unexpected. But for the pydra converter, can you take a look at this file and see if you can use it for the nipype interfaces. |
in general it would be good if you can think how do you want your workflow to look like: specify the tasks |
my expectation is that those two folders were not empty but with *.{nii.gz,json} thinking about how to 'pydra' the code and will try to add as function task |
you should think about workflow in general - you have multiple steps in this code. Ideally every single step should be a Once you have this we can think about converting this to pydra |
would this work? @pydra.mark.task
@pydra.mark.annotate({"return": {"output_image": ty.Any}})
def convert_dicom_compressed(src_folder, dst_folder, **kwargs):
""" Apply dcm2niix to convert DICOM zip/tar files
:param str src_folder: source folder name
:param str dst_folder: output folder name
:param dict kwargs: other available dcm2niix option(s), e.g. -b, -m, etc. """
stage_folder = decompress(src_folder)
output_image_ = dcm2niix(stage_folder, dst_folder, )
return output_image |
This looks like it's missing some things, but overall looks reasonable. What are |
just additional tasks that I haven't instantiated. |
Some additional comments: You can annotate the function directly. @pydra.mark.task
def convert_dicom_compressed(
src_folder : Directory,
dst_folder : str,
...) -> {"output_image": File}: I'm not sure that we handle But I might go about it differently, anyway, and make a workflow: @pydra.mark.task
def decompress(src_folder: Directory) -> Directory:
dst_dir = ...
# unzip into dst_dir
return dst_dir
wf = pydra.Workflow(name='decompress_and_convert_wf', input_spec=['src_folder'])
wf.add(decompress(src_folder=wf.lzin.src_file, name="decompress"))
wf.add(Nipype1Task(Dcm2niix(), source_dir=wf.decompress.lzout.out), name='dcm2niix)
wf.set_output([("out", wf.dcm2niix.lzout.converted_files)])
with pydra.Submitter() as sub:
sub(wf) I haven't tested this, but does the logic make sense? (cc @djarecka for suggestions on improvement) |
|
@zswgzx - we can keep this issue open during OHBM. Feel free to check our issues, but also if you can convert your script to pydra Workflow and create a notebook for pydra-tutorial, that would be really great contribution! We need more examples! Let me know if you're interested in doing this! |
absolutely! Like @effigies pointed out, a new (to me at least) way to annotate is NOT found in the tutorial (or I might miss it somewhere in the hiding). Let me know if it's relevant to update as needed. |
What are you trying to accomplish?
convert to pydra task/workflow and setup such pipeline
What have you tried?
still have trouble with nipype.interfaces.dcm2nii.Dcm2niix so any suggestion welcomed
python script
The text was updated successfully, but these errors were encountered: