shimming-toolbox / shimming-toolbox-matlab

Code for performing real-time shimming using external MRI shim coils
GNU General Public License v3.0
16 stars 5 forks source link

Use dcm2bids for conversion #89

Open jcohenadad opened 4 years ago

jcohenadad commented 4 years ago

https://github.com/cbedetti/Dcm2Bids

jcohenadad commented 4 years ago

Example of code to add in the config file that could accommodate our fieldmaps

        {
            "dataType": "fmap",
            "modalityLabel": "fmap",
            "SeriesDescription": "a_gre_DYNshim",
            "modalityLabel": "phase",
            "criteria": {
                "SeriesDescription": "a_gre_*",
                "ImageType": "*P*". # --> THAT DOES NOT SEEM TO WORK
              }
        },
gaspardcereza commented 4 years ago

It seems that dcm2bids is not compatible with Windows. https://neurostars.org/t/dicom-to-bids-conversion-on-windows/5009

jcohenadad commented 4 years ago

It seems that dcm2bids is not compatible with Windows. https://neurostars.org/t/dicom-to-bids-conversion-on-windows/5009

the answer is in the thread: Heudiconv seems to work in windows

gaspardcereza commented 4 years ago

the answer is in the thread: Heudiconv seems to work in windows

So do you propose to work with Heudiconv instead of dcm2bids ? Or just to include a "if" in the code that switches to Heudiconv if we run matlab from Windows ?

jcohenadad commented 4 years ago

the answer is in the thread: Heudiconv seems to work in windows

So do you propose to work with Heudiconv instead of dcm2bids ?

yup!

Or just to include a "if" in the code that switches to Heudiconv if we run matlab from Windows ?

omg, no "if" please 😅

kousu commented 4 years ago

dcm2bids does run on Windows. If you run python path/to/dcm2bids it goes. The problem is that, for some reason, the package up on PyPI wants to install it as dcm2bids2. This name occurs on Linux too:

$ sudo pip uninstall dcm2bids
Found existing installation: dcm2bids 2.1.4
Uninstalling dcm2bids-2.1.4:
  Would remove:
    /usr/bin/dcm2bids
    /usr/bin/dcm2bids2
    /usr/bin/dcm2bids_helper
    /usr/bin/dcm2bids_scaffold
    /usr/lib/python3.8/site-packages/dcm2bids-2.1.4.dist-info/*
    /usr/lib/python3.8/site-packages/dcm2bids/*

it's just, for some reason, on Windows the other scripts aren't wrapped in a .exe, even though they are copied to the Scripts\ folder. So it's not quite packaged properly but we can get that fixed if we raise it as a bug with them.

I tried to do pip install heudiconv on Windows and after it downloaded a huge number of dependencies it crashed at "Microsoft Visual C++ 14.0 is required", presumably to compile one of the dependencies. I would rather get dcm2bids fixed than fight with that.

kousu commented 4 years ago

Okay so here's the deal:

the version on pypi is broken, but only for Windows: https://github.com/cbedetti/Dcm2Bids/issues/79; it hasn't been updated in over a year though.

Conversely, the latest HEAD source version which has been getting work since the last PyPI publish, does work for Windows, except it is broken worse: https://github.com/cbedetti/Dcm2Bids/issues/76.

If we can solve https://github.com/cbedetti/Dcm2Bids/issues/76 for them then we can it working on Windows. EDIT: fixed https://github.com/cbedetti/Dcm2Bids/pull/80


@gaspardcereza, please try this command:

pip uninstall dcm2bids
pip install dcm2bids@git+git://github.com/kousu/Dcm2Bids@package-find_packages

I had to patch it to get it working, so you have to install my unofficial version, but that line should get you a working copy of the tool. When the original author has some time hopefully they'll be able to republish a working copy directly to pypi. And definitely record this line in your Windows-compatiblity notebook.

jcohenadad commented 4 years ago

If we can solve cbedetti/Dcm2Bids#76 for them then we can it working on Windows. EDIT: fixed cbedetti/Dcm2Bids#80

@gaspardcereza that would be a good coding exercise for your 😊

gaspardcereza commented 4 years ago

@gaspardcereza that would be a good coding exercise for your 😊

I'm currently having a look at it but it seems that Nick already solved the problem by importing the subpackages ! 😉