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

Implement functionality to specify interfaces to be connected in the workflow in the parameter file #27

Closed
sebastientourbier opened this issue Nov 5, 2020 · 6 comments · Fixed by #63
Assignees
Labels
enhancement New feature or request mid-effort
Milestone

Comments

@sebastientourbier
Copy link
Member

sebastientourbier commented Nov 5, 2020

The idea would be to be able the specify which interface is enabled in the parameter file such that the workflow is build accordingly. This will allow to be more flexible and skip processing steps.

@sebastientourbier sebastientourbier added the enhancement New feature or request label Nov 5, 2020
@pdedumast
Copy link
Member

What do you mean by "specify which interface is enabled in the parameter file"?
Isn't the workflow built accordingly, for instance when we chose to use manual/automatic masks?

@hamzake
Copy link
Member

hamzake commented Nov 10, 2020

Also which parameter file exactly?

@sebastientourbier
Copy link
Member Author

@pdedumast @hamzake The current workflow consists of number of interfaces that one might want to skip especially in the preprocessing phase.

For instance Hélène might want to skip histogram normalization for quantitative imaging (not sure thought which steps were exactly skipped by her, please @HeleneMIAL could you clarify this point?) or in the case of simulated data free of motion to skip the slice-to-volume registration step in mialsrtkImageReconstruction.

Or any other interface that you might think it's good to have such a control.

The parameter file in question is the following:

{
"01": [
{ "sr-id":1,
"stacksOrder": [1, 3, 5],
"paramTV": {
"lambdaTV": 0.75,
"deltatTV": 0.01 }
}]
}

We could think of being able to process such a file:

{ 
   "01": [ 
     { "sr-id":1, 
       "stacksOrder": [1, 3, 5], 
       "paramTV": {  
         "lambdaTV": 0.75,  
         "deltatTV": 0.01 } ,
       "steps": {  
         "HistogramNormalization": False,  
         "S2VRegistration": False} 
     }] 
 } 

Any step that would not be listed in the parameter file are considered to be True and performed in the workflow.

@pdedumast
Copy link
Member

@sebastientourbier Ok, I understand the point now, thanks for clarifying!

@helenelajous
Copy link
Member

helenelajous commented Nov 10, 2020 via email

@sebastientourbier
Copy link
Member Author

@hamzake This would requires to:

  • To extract the steps from the json file as we do for paramTV and pass them to the main() function in the docker/bidsapp/run.py:
    if 'paramTV' in sr_params.keys():
    res = main(bids_dir=args.bids_dir,
    output_dir=args.output_dir,
    subject=sub,
    p_stacksOrder=sr_params['stacksOrder'],
    session=ses,
    paramTV=sr_params['paramTV'],
    srID=sr_params['sr-id'],
    use_manual_masks=args.manual)
    # sys.exit(0)
    else:
    res = main(bids_dir=args.bids_dir,
    output_dir=args.output_dir,
    subject=sub,
    p_stacksOrder=sr_params['stacksOrder'],
    session=ses,
    srID=sr_params['sr-id'],
    use_manual_masks=args.manual)

    with the addition of a new if 'steps' in sr_params.keys(): condition and addition of a new parameter steps for the main() function (to stay consistent with the example json).
  • Modify accordingly the main() function and add a new parameter steps= for the constructor of AnatomicalPipeline as we do with paramTV
  • Modify the constructor in pymialsrtk/pipelines/anatomical/srr.py accordingly. I would suggest to add new attributes such as skip_histogram_normalization and then in the constructor you can add:
if 'HistogramNormalization' in steps.keys():
    self.skip_histogram_normalization = not steps['HistogramNormalization']

and so on for each similar step/attribute.

  • Finally, add in the create_workflow() function conditions with these new attributes to connect a node or not as we do with the use_manual_masks. If a node is not connected, make sure that the inputs of the following interface are well connected to the one before the one skipped. You might need to redefine connections. For the registration option, it would be add an option that run miasrtkImageReconstruction with the flag '--no-reg' (or similar).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request mid-effort
Projects
None yet
4 participants