Giter VIP home page Giter VIP logo

Comments (8)

agriffa avatar agriffa commented on September 13, 2024 1

After git clone dcm2bids and reinstall, everything work. Thank you for your help!

from dcm2bids.

dlevitas avatar dlevitas commented on September 13, 2024

Hi @agriffa ,

The intendedFor field needs an explicit path to the file from inside the sub-HPNC040 directory. Since your data contains ses-01, the "full path" required by the intendedFor field in your .json file is what your modified ("ses-01/func/sub-HPNC040_ses-01_task-rest7min_bold.nii.gz"). If your data did not contain a ses-01, then the intendedFor field would be "func/sub-HPNC040_ses-01_task-rest7min_bold.nii.gz".

One other thing. Are you sure that task-rest7min is BIDS compliant? Usually when I see resting-state data, it's just task-rest. But if you're not getting validation errors then I guess it's fine.

from dcm2bids.

agriffa avatar agriffa commented on September 13, 2024

Dear @dlevitas ,

Thank you very much for your answer!

I understand that the intendedFor field requires the "full path".

My problem is that if I specify "intendedFor": 0 in my dcm2bids_config file, where the first series ('0') is the func acquisition, dcm2bids will write a wrong path in the .json file. The call
dcm2bids -d /path/to/dicom/files/ -p HPNC040 -s 01 -c /path/to/dcm2bids_config.json -o /bids/folder/
writes
"IntendedFor": "func/sub-HPNC040_ses-01_task-rest7min_bold.nii.gz"
instead of
"IntendedFor": "ses-01/func/sub-HPNC040_ses-01_task-rest7min_bold.nii.gz"
in the .json file associated to the fieldmap Nifti.
Is there a way to automatically get the prefix ses-01 in the .json file, while using "intendedFor": 0 in dcm2bids_config?

I don't get errors or warnings from the bids-validator when using task-rest7min.

from dcm2bids.

dlevitas avatar dlevitas commented on September 13, 2024

Got it, sorry for the misunderstanding. Are you using the most current version of dcm2bids (2.1.4)? This was an issue in earlier versions, but in the newest version it should be resolved.

from dcm2bids.

agriffa avatar agriffa commented on September 13, 2024

Yes, I do have dcm2bids v2.1.4

pip install --upgrade dcm2bids
Requirement already up-to-date: dcm2bids in /anaconda3/lib/python3.7/site-packages (2.1.4)

I can try to git clone dcm2bids and reinstall.

from dcm2bids.

SamGuay avatar SamGuay commented on September 13, 2024

Thanks so much for opening this issue @agriffa. I couldn't get why I was getting this problem until I found your issue. After many attempts at validating my files, I found out that if someone pip install dcm2bids, it seems that it doesn't come with the #52 patch even though it was merged a while ago. So I was always getting the "IntendedFor" error.

Maybe #81 should be reviewed/merged to make sure it doesn't happen?

To validate my hypothesis, I freshly installed dcm2bids on my local computer in a virtual env and looked into the structure.py to find the missing code.

Here's what I found: I couldn't find these last 2 lines from the master branch.

                session = self.participant.session
                        opj(session, dataType, niiFile).replace("\\", "/"))
(dcm2bids) sam@FX:~/$: pip install dcm2bids
Collecting dcm2bids
  Downloading dcm2bids-2.1.4-py2.py3-none-any.whl (28 kB)
Collecting future
  Downloading future-0.18.2.tar.gz (829 kB)
     |████████████████████████████████| 829 kB 3.4 MB/s 
Using legacy setup.py install for future, since package 'wheel' is not installed.
Installing collected packages: future, dcm2bids
    Running setup.py install for future ... done
Successfully installed dcm2bids-2.1.4 future-0.18.2

(dcm2bids) sam@FX:~$ grep "session" /home/sam/.pyenv/versions/dcm2bids/lib/python3.7/site-packages/dcm2bids/structure.py
        session (str): Optional label of a session
    def __init__(self, name, session=DEFAULT.session):
        self._session = ""
        self.session = session
    def session(self):
            A string 'ses-<session_label>'
        return self._session
    @session.setter
    def session(self, session):
        if session.strip() == "":
            self._session = ""
        elif session.startswith("ses-"):
            self._session = session
            self._session = "ses-" + session
            'sub-<subject_label>/ses-<session_label>'
            return opj(self.name, self.session)
            'sub-<subject_label>_ses-<session_label>'
            return self.name + "_" + self.session
        """ Check if a session is set
        return not self.session.strip() == DEFAULT.session
(dcm2bids) sam@FX:~$ 

from dcm2bids.

arnaudbore avatar arnaudbore commented on September 13, 2024

@SamGuay is still the case with v2.1.5 or #107 ?

from dcm2bids.

SamGuay avatar SamGuay commented on September 13, 2024

Just installed it in a fresh venv and it seems to be there!

        return self.session.strip() != DEFAULT.session
                session = self.participant.session
                intendedValue.append(opj(session, dataType, niiFile).replace("\\", "/"))

from dcm2bids.

Related Issues (20)

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.