Giter VIP home page Giter VIP logo

macapype's Introduction

Downloads Build Status

Quick Install

To use it:

pip install macapype

To develop:

git clone https://github.com/Macatools/macapype.git
cd macapype
python setup.py develop

Docker image

docker pull macatools/macapype/latest

Documentation

https://macatools.github.io/macapype/

Related to project:

A guide for PNH MRI processing, and in particular, the session on structural MRI processing

Open Science Room OSR 2020 of OHBM congress presentation of macapype

Forum macapype_users

The macapype_users can be be found here (requires a framateam/framagit account, but should be accessible with a github or bitbucket account)

macapype's People

Contributors

bastiencagna avatar davidmeunier79 avatar kepkeeloh avatar maximedieudonne avatar mdobraz avatar melinacordeau avatar ostanley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

macapype's Issues

Cannot find example data such as "data_test_macaque_processed.zip"

Hi,
I am trying to run the example "Plot the results of a segmentation with SPM-based pipeline T1xT2", but there is an error in the line "data_path = load_test_data("data_test_macaque_processed")". It says : AssertionError: Error, data_zip = C:\Users\dell\data_macapype\data_test_macaque_processed.zip not found .
I checked the C:\Users\dell\data_macapype folder and fount it empty. I also try to run other examples and met the similar error when trying to load the example data.

I would hope to ask where to find or to download the example data. Thank you very much!

Add -species in the command

As we are now extending the package to further NHP species (including so macaque, marmoset, baboon and more recently chimpanzee, the number of corresponding params file are increasing; in fact , in extra to template choise, only some nodes are critical for each species (in particular, atlas_brex parameters in ANTS pipelines); most of the other are similar.

The idea would be to keep the -params but makes it optionnal, and add a new -species, with predefined keyword (i.e."macaque", "marmoset", "baboon", "chimpanzee") that would take a default params file, already created (most of them already exists).

ENH: More nipype style documentation for easier end use

Re: our Jan 21 meeting here are two examples of the atlas brex documentation. I think the piece that is missing is a listing of the actual params, and roughly what they do, and a default setting. Everything I added for this I grabbed from either the AtlasBrex class or the bash script itself.

Current:

inputnode:
restore_T1: preprocessed (debiased/denoised) T1 file name
restore_T1: preprocessed (debiased/denoised)T2 file name

arguments:
params_template: dictionary of info about template
params: dictionary of node sub-parameters (from a json file)
name: pipeline name (default = “extract_pipe”)

Outputs:
smooth_mask.out_file: Computed mask (after some smoothing)

Proposed:

inputnode:

  • restore_T1: preprocessed (debiased/denoised) T1 file name
  • restore_T1: preprocessed (debiased/denoised)T2 file name

arguments:

  • params_template: dictionary of info about template
    • template_head: Atlas with skull default: NMT
    • template_brain: Atlas with skull removed, default NMT_SS
  • params: dictionary of node sub-parameters (from a json file)
    • f: initial BET fraction, default 0.5
    • reg: method of template registration, default 1
      0 = FNIRT w/ bending
      1 (default) = FNIRT membrane-energy regularization
      2 = ANTs/SyN w/ N4Bias
      3 = w/o N4Bias
    • w: warp resolution, default 10,10,10
    • msk: mask binarization threshold (in %) for fslmaths default a,0,0
  • name: pipeline name (default = “extract_pipe”)

Outputs:

  • smooth_mask.out_file: Computed mask (after some smoothing)

Tutorial

How to add a new parameter?

How to create your own pipeline?

replace zeros by NaN in 5tt derivatives

For visualization with mrtrix, zeros are not understood as background so it is not possible to use the 3D view anymore - everything is inside a gray box-. If replaced by NaNs, the different tissues could be visualized in 3D using mrtrix.

bug nifti_reg and spm version

DEBUG avec remi:

  • probleme avec le git clone de nifti reg ?
  • replace ?/nodes/../bash par ?/bash directement dans le node AtlasBREX

For segment_pnh relative -out paths lead to results in the wrong path

segment_pnh -data inputs/BIDS_raw -out outputs -sub 001 -ses 001 -soft ANTS -params code/params_segment_macaque_ants.json -deriv -pad -nprocs 2

produces the following:


outputs/derivatives/macapype_orig_ants
└── [   3]  sub-001
        └── [   3]  ses-001
            └── [   3]  anat
                └── [   3]  datasink
                    └── [   3]  outputs
                        └── [   3]  derivatives
                            └── [   3]  macapype_orig_ants
                                └── [   3]  sub-001
                                    └── [   3]  ses-001
                                        └── [  10]  anat

full paths get it right:

segment_pnh -data $(pwd)/inputs/BIDS_raw -out $(pwd)/outputs -sub 001 -ses 001 -soft ANTS -params code/params_segment_macaque_ants.json -deriv -pad -nprocs 2

outputs/derivatives/macapype_orig_ants
└── [   3]  sub-001
        └── [   3]  ses-001
              └── [  10]  anat

For portable setup of the computational environment, relative paths are essential.
Great tool, keep up the great work!

Freesurfer space discussion

Re: our meeting I am putting this here so it is in a central place. There are two reasons that freesurfer and macapype may not play nice together.

There are two freesurfer issues where it changes data in disadvantageous ways:

  1. run with the tag -hires or it will always resample to 1m iso. That is a recon-all tag so it is not in all binaries but most.
  2. freesurfer puts things in its freesurfer space (which leaves them in RAS in other viewers like itksnap).
    For surfaces the command mris_convert with the --to-scanner flag will apply the correct transform to fix this.
    For volumes it is the transform given by mri_info --vox2ras-tkr orig.mgz I think but I am less sure.

Make an output folder BIDS compatible in derivatives/

I wonder if we should not create and output folder where all the useful images will be: brain mask, segmentation tissue probability images, surfaces ... It is cumbersome to navigate through all the directories created by nipype. It is ok for debugging, not for production. If I take the example of fmriprep, which paves the way, the nipype outputs go into a temporary folder and the usable output is saved in the derivatives/fmriprep folder of the project.

Docker instructions missing path

Hi, thanks for making this package!

I successfully installed macapype via Docker and tried to run it using the instructions provided here.

Unfortunately, /opt/packages/macapype/workflows/ used in the commands does not exist in the container. I am aware that the segment_pnh command can be used instead (see n.b. here), however, params_segment_pnh_ants_based.json cannot be found. I don't know if I'm missing something or if there is an error in the instructions. Any guidance here would be helpful! Thanks

adding a software license?

Hi, browsing the repo, I see that there's no software license defined for macapype... I think it'd be good to define one ;)

add transfo in derivatives

Keep the reg aladin + NMT_subject_align / animal_warp linear and non linear transfo, as well the inverse trans, in the derivatives + renamed properly

pipeline with T1 only file

pipeline with T1 only file. Modify the correct bias by debias N4 → leads to new functions with _T1 in the name ?

Making macapype cli run as executable (in particular if installed with pip)

So far, even if macapype exists on pypi, there is no real way to launch macapype except from cloning the github repo and
$ python workflows/segment_pnh.py ...
(the workflows directory in not packaged yet, neither is the segment_pnh.py)
There should be solutions with the equivalent of an executable whose location could be added to the PATH once installed; could be related to issue #129, the params.json files are not involved in the package either

Add -species in the command (sorry for closing accidentally)....

As we are now extending the package to further NHP species
(including so macaque, marmoset, baboon and more recently chimpanzee,
the number of corresponding params file are increasing; in fact , in
extra to template choise, only some nodes are critical for each species
(in particular, atlas_brex parameters in ANTS pipelines); most of the
other are similar.
The idea would be to keep the -params but makes it optionnal, and add
a new -species, with predefined keyword (i.e."macaque", "marmoset",
"baboon", "chimpanzee") that would take a default params file, already
created (most of them already exists).

Options when subjects fail in crop_aladin stage

Inspired from subject sub-032159 in site-mountsinai-S from PRIME-DE, which fail miserably since the first step of macapype.

Here is for instance the image after the first stage:
Capture d’écran 2022-09-22 à 18 03 45

  • option 1
    -- Prepare the data with FSL-FAST:
    fast -l 8 -B sub-032159_ses-001_run-1_T1w.nii.gz
    -- Apply the reg_aladin command used in macapype to the bias corrected image:
reg_aladin -aff sub-032159_ses-001_run-1_T1w_aff.txt -flo sub-032159_ses-001_run-1_T1w_restore.nii.gz -ln 12 -lp 10 -nac -noSym -omp 1  -ref /Users/jsein/Documents/Centre_IRMf/DATA/BIDS/Covoprim/inia19-t1.nii -res sub-032159_ses-001_run-1_T1w_restore_res.nii.gz -rigOnly -smooR 1.000000

-- Apply the calculated transform to the original image

reg_resample -flo sub-032159_ses-001_run-1_T1w.nii.gz -ref /Users/jsein/Documents/Centre_IRMf/DATA/BIDS/Covoprim/inia19-t1.nii  -res test.nii.gz -trans sub-032159_ses-001_run-1_T1w_aff.tx

This is the result:
Capture d’écran 2022-09-22 à 18 09 02

  • option 2 (much faster)
    -- change the parameters of reg_aladin on the original image:
reg_aladin -aff sub-032159_ses-001_run-1_T1w_aff.txt -flo sub-032159_ses-001_run-1_T1w.nii.gz -ln 8 -lp 10 -nac -noSym -omp 1  -ref /Users/jsein/Documents/Centre_IRMf/DATA/BIDS/Covoprim/inia19-t1.nii -res sub-032159_ses-001_run-1_T1w_res.nii.gz -rigOnly -smooR 1.000000

=> same result

Add -template for users to specify their own template

Several users, in particular using pediatric data, requested to provide local template; it should be taken into account that their is now two types of tissues priors provided, one with 3 different files for csf/gm/wm (proba_priors), and one with index based tissues in one file

[MINOR] Some minor issues Dockerfile

-IsoSurface (AFNI) is bugging as libXp6.so is missing, fixed in skullTo3d but would make more sense to add it in the macapype_env directly

  • the clean up is not properly set (not a big problem)

Segmentation from T2w scans

Sometimes, the T2-weighted images might give better contrast for the WM/GM segmentation, i.e. for very young and poorly myelinated brains.

So it would be interesting to adapt macapype to have an option to perform segmentation using T2-weighted images.

Docker

  • make sure the docker are working properly (both Dockerfile and Docker pull version)
  • use the docker to create proper unit-test

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.