Giter VIP home page Giter VIP logo

dcm2bids's People

Contributors

alexandreroutier avatar arnaudbore avatar cbedetti avatar dependabot[bot] avatar gmerakis avatar hackmd-deploy avatar hstojic avatar islast avatar jcohenadad avatar joey-scanga avatar jooh avatar josephmje avatar jstaph avatar kastman avatar keithcallenberg avatar kousu avatar po09i avatar remi-gau avatar samguay avatar smeisler avatar yarikoptic avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

dcm2bids's Issues

Usage example

Can someone please give me an example of dcm2bids command line usage?
It is not clear to me how I should use it.

  • what is [-h]?

  • what should be after -d? what is DICOM_DIR? Is it the directory that contains *.IMA files? what if I have only access to the *.DCM files?

  • what should be after -p? what does PARTICIPANT mean? should it be the subject ID(s)?

-what is a SESSION? what if not all subjects have the same number of the sessions?

-what is [--clobber]?

I really appreciate if you could give me an actual example that clarifies my questions.
Thank you for your time!

Mahmoud

siemens dicoms not recognised as dicom files

The siemens dicom files we have aren't recognised as as DICOM files by Dcm2Bids. I

'm assuming this is because Siemens doesn't have the correct 'dicm' string after byte 128, as mentioned here

I can use pydicom with the force=True argument to read these files.

Is there any way to pass this force=True argument to the calls to pydicom in Dcm2Bids?

or any other workaround?

4D GE spin echo field maps: AP/PA both in one NIfTI

Hi,

We at OHSU in Portland, OR, USA, are trying to process ABCD Study data from GE scanners and the two 3D volumes of forward (posterior-anterior) & reverse (anterior-posterior), aka. parallel & anti-parallel, phase encode direction GE spin echo field maps are concatenated in the 4th dimension so they are always an (X-by-Y-by-Z-by-2) 4D volume (I think this is what GE NIfTI's always do with spin echo field maps).

Dcm2Bids only produces one NIfTI and one JSON sidecar, even though the NIfTI's should split on the 4th dimension into two separate 3D volumes whose PhaseEncodingDirection JSON sidecar field should be <i, j, or k> and <i, j, or k>-.

We have a hacky workaround for this right now which involves us splitting the NIfTI and copying the sidecar JSON into two sidecar JSON's, one for each volume, then re-labeling the incorrect PhaseEncodingDirection in one of them.

Anyway, let me know if I can provide any more help to get this resolved.

~Eric

Dcm2bids cannot differentiate between non-normalized MRI data and normalized MRI data

I'm attempting to convert dicoms to niftis using the dcm2bids command.

In the config.json file, I added a custom label to ensure that only normalized data is being converted to niftis.

{
            "dataType": "anat",
            "modalityLabel": "T1w",
            "customLabels": "rec-normalized",
            "criteria": {
                "SeriesDescription": "T1w_MPR_vNav",
                "ImageType": [
                    "NORM"
                ]
            }
        },

If the subject only has one run of normalized data but multiple non-normalized T1 runs, the dcm2bids command will still convert all T1's into niftis regardless of the custom label. This issue occurs both for the T1's and the T2's.

Other than manually deleting all non-normalized data, is there way to exclude them in the config.json file to prevent this error from occuring?

Here is the original format, and I want to exclude the ORIGINAL, PRIMARY, M, and ND categories.

Thanks in advance!

{
            "dataType": "anat",
            "modalityLabel": "T1w",
            "criteria": {
                "SeriesDescription": "T1w_MPR_vNav",
                "ImageType": [
                    "ORIGINAL",
                    "PRIMARY",
                    "M",
                    "ND",
                    "NORM"
                ]
            }
        },

Might be useful to somehow link repos - hpc paralellization & quality check

Hey,

Thanks for writing your scripts, they've been incredibly useful.

I wrote some additional scripts that work with yours to (1) run jobs for subjects in parallel in a high performance cluster environment and (2) to check the number of runs for each sequence that end up in BIDS against the expected number and to correct them if possible. I wonder if it might be useful to others to somehow link the repos, if you're interested.

https://github.com/kdestasio/dcm2bids/tree/master/bidsQC

Best,
Krista

Tips for using anonymiser option

Hi there,

do you have any tips on anonymiser tools that would play well with dcm2bids?

e.g., I'm looking at Poldrack lab utility here, but not sure it conforms the requirements. Perhaps it can be wrapped in a shell script to fit the bill, perhaps somebody has an example to share?

Hrvoje

dcm2bids_helper from python

Hi,
thank you for these really useful tools!

I'm having some issues with dcm2bids_helper:
when I run the script from the shell everything works fine, but when I try to run it from within a python script it
just clears the output directory without copying the results to it. I just can't figure out what's going on here!
So, for the Shell:

dcm2bids_helper -d ~/final/subject_300_210 -o /output

works just fine!
But, from python:

test_sidecar = dcm2bids.Dcm2niix(dicom_dir=patient_dir_path, bids_dir=output_helper,
logger=False)
test_sidecar.run()

just runs, seems to do something, clears the output directory but doesn't write anything to it?? Regardless if forceRun is set or not!

Any ideas why this is the case?
(I'm on macOS, dcm2bids 1.1.8)

Thanks

Add 'TaskName' to bold json

Apparently the Bids validator needs 'TaskName', which is not exported by dcm2bids and it has to be done by hand.
Perhaps this can be implemented.

Thanks

Eduardo

Issue during conversion when localizer dicoms missing

Hello,

I've been getting some data off our scanner (Siemens MAGNETOM PRISMA), and have been using dcm2bids and dcm2niix (v1.0.20181125) to properly get it into BIDS format. I just ran into an issue with one participant where the conversion is offset by one sidecar.

Sidecars matching:
MATCH           002_sub-001_T1w_MPR_20180928130637.json
MATCH           003_sub-001_T1w_MPR_20180928130637.json
MATCH           004_sub-001_SpinEchoFi..PA_20180928130637.json
MATCH           005_sub-001_SpinEchoFi..AP_20180928130637.json
MATCH           006_sub-001_cmrr_mbep2..OL_20180928130637.json
MATCH           007_sub-001_cmrr_mbep2..OL_20180928130637.json
MATCH           008_sub-001_cmrr_mbep2..OL_20180928130637.json
MATCH           009_sub-001_cmrr_mbep2..OL_20180928130637.json
MATCH           010_sub-001_cmrr_mbep2..OL_20180928130637.json
MATCH           011_sub-001_cmrr_mbep2..OL_20180928130637.json
MATCH           012_sub-001_cmrr_mbep2..OL_20180928130637.json
MATCH           013_sub-001_cmrr_mbep2..OL_20180928130637.json
NO MATCH        014_sub-001_T2w_SPC_20180928130637.json

Unlike other data in this dataset, there are no localizer dicoms for this subject. Normally the sidecar filenames are:

001*=localizer
002*=non-normalized T1w
003*=normalized T1w

However, for this subject, it's:

001*=non-normalized T1w
002*=normalized T1w

This is the only discrepancy I've found that may be causing my issue, but I'm unsure why, and wanted to see if anyone has any guidance regarding this?

For reference, this is the config file for this subject:

{
   "descriptions": [
      {
         "dataType": "anat", 
         "modalityLabel": "T1w", 
         "criteria": {
            "SidecarFilename": "002*"
         }
      }, 
      {
         "dataType": "fmap", 
         "modalityLabel": "epi", 
         "criteria": {
            "SidecarFilename": "003*"
         }
      }, 
      {
         "dataType": "fmap", 
         "modalityLabel": "epi", 
         "criteria": {
            "SidecarFilename": "004*"
         }
      }, 
      {
         "dataType": "func", 
         "modalityLabel": "bold", 
         "customLabels": "task-std", 
         "criteria": {
            "SidecarFilename": "005*"
         }
      }, 
      {
         "dataType": "func", 
         "modalityLabel": "bold", 
         "customLabels": "task-std", 
         "criteria": {
            "SidecarFilename": "006*"
         }
      }, 
      {
         "dataType": "func", 
         "modalityLabel": "bold", 
         "customLabels": "task-std", 
         "criteria": {
            "SidecarFilename": "007*"
         }
      }, 
      {
         "dataType": "func", 
         "modalityLabel": "bold", 
         "customLabels": "task-std", 
         "criteria": {
            "SidecarFilename": "008*"
         }
      }, 
      {
         "dataType": "func", 
         "modalityLabel": "bold", 
         "customLabels": "task-std", 
         "criteria": {
            "SidecarFilename": "009*"
         }
      }, 
      {
         "dataType": "func", 
         "modalityLabel": "bold", 
         "customLabels": "task-std", 
         "criteria": {
            "SidecarFilename": "010*"
         }
      }, 
      {
         "dataType": "func", 
         "modalityLabel": "bold", 
         "customLabels": "task-std", 
         "criteria": {
            "SidecarFilename": "011*"
         }
      }, 
      {
         "dataType": "func", 
         "modalityLabel": "bold", 
         "customLabels": "task-std", 
         "criteria": {
            "SidecarFilename": "012*"
         }
      }, 
      {
         "dataType": "anat", 
         "modalityLabel": "T2w", 
         "criteria": {
            "SidecarFilename": "013*"
         }
      }
   ]
}

Thank you for the assistance.

Dan

Impossible to run dcm2bids on shared folder between vbox Linux and host Windows

Hello,

I am running dcm2bids on a virtualbox Ubuntu with host windows. My data being on a hard disk, I mounted it as a shared folder in the guest virtual machine. When I try running dcm2bids_scaffold, dcm2bids_helper there are no problems. However, I get these messages when I try running dcm2bids:

Traceback (most recent call last):
File "/home/manon/.local/bin/dcm2bids", line 114, in
sys.exit(main())
File "/home/manon/.local/bin/dcm2bids", line 109, in main
app = Dcm2bids(**vars(args))
File "/home/manon/.local/lib/python2.7/site-packages/dcm2bids/dcm2bids.py", line 55, in init
self.set_logger()
File "/home/manon/.local/lib/python2.7/site-packages/dcm2bids/dcm2bids.py", line 94, in set_logger
setup_logging(self.logLevel, logFile)
File "/home/manon/.local/lib/python2.7/site-packages/dcm2bids/logger.py", line 21, in setup_logging
handler = logging.FileHandler(logFile)
File "/usr/lib/python2.7/logging/init.py", line 920, in init
StreamHandler.init(self, self._open())
File "/usr/lib/python2.7/logging/init.py", line 950, in _open
stream = open(self.baseFilename, self.mode)
IOError: [Errno 71] Protocol error: '/home/manon/shared/Data_MRI/dcm2bids/tmp_dcm2bids/log/sub-ECSH6_ses-01_2019-09-10T15:30:19.944681.log'

Has anyone seen this already? and do you think there is a way to fix this problem?

Thanks and best

logFile duplicates

Hi,
I'm processing a dataset with ca. 400 MR-scans with dcm2bids.
To get an overview of the number of MATCH/NO MATCHes I'm parsing the log-files.
The problem is that dcm2bids writes a lot of logfiles with duplicate entries. So it's never totally
clear which logfile to use for counting/parsing.
When I look at your code it seems that dcm2bids should write one logfile per scan. Is it possible that
the filehandler in the logger is not closed properly or something like that? If tried to test it, but I don't really know how to access the Filehandler in the logger at the end of the run() call.
Have you any ideas what could cause this behaviour?

Thanks

Add Multiple IntendedFor

So far it's not possible to use multiple values for IntendedFor argument.
Will be working on this!

How to reorganize T1_FLAIR, T2_FLAIR,T1,T2 into anat folder

I have some 'T2_FLAIR' nifti files. Since 'T2_FLAIR' matches both 'T2w' and 'FLAIR', according to dcm2bids documentation, sidecars with more than one matching descriptions are kept in dcm2bids_data directory. But if I want to put this file into BIDS anat folder, does dcm2bids provides this feature?

Session Info Problem

Hello,
This is piggy-backing off of issues #51 and #52. I'm using version 2.1.4, and have the following setup in my configuration for my spin echo field maps:

{
         "dataType": "fmap",
         "modalityLabel": "epi",
         "IntendedFor": [
            11
         ],
         "criteria": {
            "SidecarFilename": "021*"
         }
      },
      {
         "dataType": "fmap",
         "modalityLabel": "epi",
         "IntendedFor": [
            11
         ],
         "criteria": {
            "SidecarFilename": "022*"
         }
      },

My dcm2bids command is dcm2bids -d $data_dir -p 100 -s 01 -c $config_file_dir/config_file.json -o $output_dir --forceDcm2niix

The issue for me is that when I check the IntendedFor field in the fmap JSON files, the session information is not specified. For example my IntendedFor section is

"IntendedFor": [
        "func/sub-100_ses-01_task-rest_run-01_bold.nii.gz",
        "func/sub-100_ses-01_task-video_run-01_bold.nii.gz",
        "func/sub-100_ses-01_task-video_run-02_bold.nii.gz"
    ]

instead of

"IntendedFor": [
        "ses-01/func/sub-100_ses-01_task-rest_run-01_bold.nii.gz",
        "ses-01/func/sub-100_ses-01_task-video_run-01_bold.nii.gz",
        "ses-01/func/sub-100_ses-01_task-video_run-02_bold.nii.gz"
    ]

It appears that dcm2bids was updated to add session information to the path, so I was wondering if there is something else I need to do in order to have this show up in my .json files.

Thanks for the help.

Match on lists

It would be helpful to match on list elements. For example, acquisitions may undergo different filtering/reconstruction options that are differentiated only in the "ImageType" elements, e.g.
"ImageType": ["ORIGINAL", "PRIMARY", "M", "ND", "NORM"],
"ImageType": ["ORIGINAL", "PRIMARY", "M", "ND"],

Adding "ImageType": ["ORIGINAL", "PRIMARY", "M", "ND", "NORM"]
criteria has no effect-the two reconstructions appear as separate runs.

Where to type the command?

Hi,

this problem might be a silly one, but I don't know where to type the command like "dcm2bids -d sourcedata/s101/DICOM/ -s S101 -c code/config_dcm2bids.json".

I'm using Windows7, and the cmd doesn't accept this command.

Error running dcm2bids

Hi,
I followed the instruction for downloading and adding to the PATH.
After running the dcm2bids I receive this error:

[zeydabadi@node3 mz]$ dcm2bids
Traceback (most recent call last):
File "/home/zeydabadi/mz/Dcm2Bids/scripts/dcm2bids", line 7, in
from dcm2bids.dcm2bids import Dcm2bids
File "/home/zeydabadi/mz/Dcm2Bids/dcm2bids/dcm2bids.py", line 7, in
from .sidecarparser import Sidecarparser
File "/home/zeydabadi/mz/Dcm2Bids/dcm2bids/sidecarparser.py", line 7, in
from future.utils import iteritems
ImportError: No module named future.utils

Will you please help me to fix it?
Thanks!
Mahmoud

Issue with multiple sessions

Hello,

This seems like a great tool, but I am having difficultly running it with subjects that have multiple sessions. In the output directory for each subject it adds scans from each previous session as an additional run in the current session.

It could be me but I don't think I'm doing anything silly in a for loop. When executed the session & subject are explicitly included. In the tmp_dcm2bids dir the sessions are labeled correctly but then there seems to be a problem moving it across into the main structure.

Is this a general issue or am I being dense?

Config File

Hi ,
Trying to design a config files with heuristics. Are there any resources where there are already existing config files or will you be able to help us design one. If you are willing to share your's that would be great too.
Thanks for you time

parser error

Hi Christophe,

Thanks so much for this tool. I am running into an error when trying to convert my mprage to bids. My json (as txt file) is attached and my command is: dcm2bids -d sub1 -p 001 -c sub1_mprage_5e_20140427134518_13.json

I get the following error: raceback (most recent call last):
File "/usr/local/dcm2bids/07.19.2017/scripts/dcm2bids", line 61, in
sys.exit(main())
File "/usr/local/dcm2bids/07.19.2017/scripts/dcm2bids", line 57, in main
return app.run()
File "/usr/local/dcm2bids/07.19.2017/dcm2bids/dcm2bids.py", line 35, in run
parser = Sidecarparser(dcm2niix.sidecars, self.config["descriptions"])
KeyError: 'descriptions'

Thanks very much for your help!

Best,
Alex

sub1_mprage_5e_20140427134518_13.txt

Integrate testing framework

This project would benefit from a testing framework (e.g., CircleCI, Travis) to make sure the baseline branch won't break.

dcm2bids_config -"intendedFor": 0- writes the reference file path without session number

Hello!

I'm running dcm2bids on a set of fMRI and fieldmap data.
I would like to refer the fieldmap data to the fMRI acquisition.
I therefore use the option "intendedFor" in the dcm2bids_config.json file (pasted below).

After running dcm2bids on my data, the fieldmap json contains the following line:
"IntendedFor": "func/sub-HPNC040_ses-01_task-rest7min_bold.nii.gz",
which gives an error in the online bids validator:
Error 1: [Code 37] INTENDED_FOR.
'IntendedFor' property of this fieldmap does not point to an existing file'.

Modifying the fieldmap json with the following line corrects the bids validator error:
"IntendedFor": "ses-01/func/sub-HPNC040_ses-01_task-rest7min_bold.nii.gz".

Is there a problem with how dcm2bids handles the "intendedFor" option, or am I missing some fundamental step?

Thank you very much for your help and work!
I hope I am posting this issue in the right place.

Best regards,
Alessandra

My dcm2bids_config.json file looks like this:

{
"searchMethod": "fnmatch",
"defaceTpl": "pydeface --outfile {dstFile} {srcFile}",
"descriptions": [
{
"dataType": "func",
"modalityLabel": "bold",
"customLabels": "task-rest7min",
"criteria": {
"SeriesDescription": "cmrr_mbep2d_bold_tr1000"
},
},
{
"dataType": "fmap",
"modalityLabel": "phasediff",
"criteria": {
"SeriesDescription": "gre_field_mapping",
"SeriesNumber": 7
},
"sidecarChanges": {
"EchoTime1": 0.00449,
"EchoTime2": 0.00695
},
"intendedFor": 0
}
]
}

dcm2bids not ordering runs chronologically

We have cases where the order of task-rest data has been changed after conversion. The end sidecar jsons have been mapped [3rd, 4th, 1st, 2nd] -> [run-01, run-02, run-03, run-04].

how is the ordering currently determined?

the Acquisition Time in the sidecar jsons for run-03 and run-04 have earlier times than run-01 and run-02. Is there are reason it shouldn't be sorted by AcquisitionTime in the first place?

I can work with you to test/discover where the error is occurring. I may be able to share the data under certain circumstances.

EDIT:
I have discovered the source of the problem.

Some dicom Series Numbers are padded with a double zero at the end, .e.g., the 4th scan would be 400. This seems to have to do with acquisition parameters unique to those modalities. Within the code, it assumes that a standard ASCII sort will work because small Series Numbers (1, 2,... 99) are padded with 0s to be three digits long, however these 00-padded modalities are not padded in this manner.

This bug will occur in the case that a given task is 00-padded by the scanner, and is acquired as the (1st..9th) series, then acquired additional times as 10th or later series...

e.g.
tmp_dcm2bids/sub-name/
008_sub-name-desc_date.json # not padded by scanner, 8th run
009_sub-name-desc_date.json # not padded by scanner, 9th run
1000_sub-name-desc2_date.json # this is actually the 10th run, 00-padded
700_sub-name-desc2_date.json # this is actually the 7th run, 00-padded, but sorted chronologically later

I don't know the reason why Philips/GE are using this 00-pad, I will try to find out.

Exclusion criteria

Is it possible to have a criteria that helps exclude an image. For example, for our DWI routines we want to convert the raw data to BIDS, but exclude the console-generated derived Trace/FA maps. For our Siemens hardware, the derived images have almost identical BIDS tags to the raw data, but we can ignore them if we can exclude files with "ImageType": "DERIVED".

For this specific case I realize I can also modify your script:
self.options = "-b y -ba y -z y -f '%3s_%f_%p_%t'"
to read
self.options = "-i y -b y -ba y -z y -f '%3s_%f_%p_%t'"

But there are other cases where this would help (for example, GE and Philips tend not to label their derived images in the ImageType tag).

        {
            "dataType": "dwi",
            "modalityLabel": "dwi",
            "criteria": {
                "SequenceVariant": "SK_SS"
            }
            "exclude": {
                "ImageType": "*DERIVED*"
            }
        }

CalledProcessError newest version

Hi, I just tried the newest version of dcm2bids and I occasionally get the following error

Error: Photometric Interpretation 'PALETTE COLOR' not supported
Traceback (most recent call last):
  File "/home/stephan/miniconda2/envs/dcm2bids/bin/dcm2bids", line 114, in <module>
    sys.exit(main())
  File "/home/stephan/miniconda2/envs/dcm2bids/bin/dcm2bids", line 110, in main
    return app.run()
  File "/home/stephan/miniconda2/envs/dcm2bids/lib/python3.7/site-packages/dcm2bids/dcm2bids.py", line 103, in run
    dcm2niix.run(self.forceDcm2niix)
  File "/home/stephan/miniconda2/envs/dcm2bids/lib/python3.7/site-packages/dcm2bids/dcm2niix.py", line 91, in run
    self.execute()
  File "/home/stephan/miniconda2/envs/dcm2bids/lib/python3.7/site-packages/dcm2bids/dcm2niix.py", line 104, in execute
    output = run_shell_command(cmd)
  File "/home/stephan/miniconda2/envs/dcm2bids/lib/python3.7/site-packages/dcm2bids/utils.py", line 109, in run_shell_command
    return check_output(shlex.split(commandLine))
  File "/home/stephan/miniconda2/envs/dcm2bids/lib/python3.7/subprocess.py", line 395, in check_output
    **kwargs).stdout
  File "/home/stephan/miniconda2/envs/dcm2bids/lib/python3.7/subprocess.py", line 487, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['dcm2niix', '-b', 'y', '-ba', 'y', '-z', 'y', '-i', 'y', '-f', '%3s_%p_%z_%t', '-o', '/media/stephan/data_big/bids_data/tmp_dcm2bids/sub-NS143_ses-preimplant01', '/media/stephan/data_big/bids_data/sourcedata/sub-NS143/ses-preimplant01/MR']' returned non-zero exit status 1.

The dicoms get converted into niftis and stored in the tmp directory but then don't get renamed or any further processing. I've tried reinstalling a few times already. Any ideas what may be causing this? Thank you again for this app

Configuration File for Field Mapping Data

Hello,

I'm putting together a configuration file for running dcm2bids; however, I'm unsure how to format the field mapping portion. The field mapping data consists of two spin echoes with opposite phase directions. Essentially, I don't know what I need to put in the configuration file for the "modalityLabel" and "criteria" sections.

Thanks.

intendedfor not working properly

Hi,
I used the new intendedFor key to add the option within the json. I've got 3 different b0s for 3 different DWIs within the same session but for all b0s the json gives me:

"IntendedFor": "fmap/sub-01_sess-01_b0.nii.gz"

which doesn't exist.

Add regex examples in the documentation

It's possible to be more flexible with "searchMethod": "re"

Put example in the documentation to do thing like :

  • "EchoTime": > 0.1
  • "SeriesDescription": "MPRAGE" or "IR-FSPGR"

Issue with dcm2bids_helper

Hello,

I tried building a configuration file; however, I received the following error:

No handlers could be found for logger "dcm2bids"
Example in:
/Users/username/anaconda/bin/tmp_dcm2bids/helper

I checked this helper directory, but it was empty.

I installed dcm2bids a few days ago using the following commands:

git clone https://github.com/cbedetti/Dcm2Bids.git
cd Dcm2Bids
pip install .

My python version is Python 2.7.13, and I am using MacOS Sierra 10.12.6

Is there something else I need to do in order to produce the configuration file?

Configuration file setup for field maps with 2 magnitude images

Hello,

I'm converting some dicom data to BIDS; however, I'm running into trouble with the field maps. For this specific dataset, two magnitude images and 1 phase difference image are collected. The portion of my configuration file for these field maps is:

{
         "dataType": "fmap",
         "modalityLabel": "magnitude",
         "IntendedFor": [
            2,
            3,
            4
         ],
         "criteria": {
            "SidecarFilename": "003*"
         }
      },
      {
         "dataType": "fmap",
         "modalityLabel": "phasediff",
         "IntendedFor": [
            2,
            3,
            4
         ],
         "criteria": {
            "SidecarFilename": "004*"
         }
      },

The output files in the fmap directory for the magnitude images are: sub-1_run-01_magnitude.nii.gz, sub-1_run-02_magnitude.nii.gz, though according to the BIDS 1.1.1 version spec, it appears that they should be labeled as sub-1_run-01_magnitude1.nii.gz and sub-1_run-01_magnitude2.nii.gz My issue though is that both magnitude images have the same sidecar (*003), where the first half relate to the first magnitude file, and the second half dicoms are the 2nd magnitude file, so I was wondering if there is a way I can format my configuration file to output the correct file names?

Thanks,

Dan

Optional -m flag

Hi,

First, thanks for creating this. I'm a regular user and it helps a lot. I work with MR and CT images so I need to use dcm2niix flag -m for the CT images. Is there any chance this can be an optional argument? Again, thank you for creating this.

Make "dicom_dir" parameter also a string instead of only a list

Hi,

I'm having two problems and I'm not sure if they are related. I'm running the package through python using the simplest syntax as a test:

`from dcm2bids import dcm2bids

dcms=dcm2bids.dcm2bids(dicom_dir='mydir', participant='subj', config='myconfig', output_dir='outdir')
dcms.run()

`
When I call the run method it first searches sub-strings of the DICOM directory. For example, if the directory is 'jd56', it returns:

Unable to find DICOM images in j
Unable to find DICOM images in d
Unable to find DICOM images in 5
Unable to find DICOM images in 6

Then it continuously prints the following: "Problem reading ECAT7 file!"

I'm using python v3.5, with dcm2bids v1.1.8 on a linux server.

Any help would be much appreciated!

Questions on file configurations

Hi!

I have a question regarding how to configure my (original) DICOM files for the function to read. I tried the dcm2bids_helper function on one of my participants data (one run) to derive an example configuration file but it says "No handlers could be found for logger "dcm2bids". Any hint would be helpful!

Thanks!

How to deal with the data which have 1 json and 2 nii.gz

Hi ,

Thank you for making this toolbox and I like this toolbox!
But, I faced a problem while using various type of data sets.
There is a fieldmap data which have 1 json and 2 nii.gz in Philips data.
e.g.)
Fieldmap4.92testCLEAR4.2_19770703150928_ph.json
Fieldmap4.92testCLEAR4.2_19770703150928_ph_1.nii.gz
Fieldmap4.92testCLEAR4.2_19770703150928_ph_2.nii.gz

In this case, dcm2bids could only pick and change name the json data only.
The other two nii.gz are in the tmp_dcm2bids folder.

My question is
How to deal with this kind of data?

Thanks for you time

Question regarding fmap "IntendedFor" field

Hi,

In my configuration file I'm incorporating the "IntendedFor" field for my spin echo fmaps; however, I'm a little unsure how to properly fill in this field. If for example I have three functional runs that the fmaps are supposed to act on, is this the proper format?:
"IntendedFor": [5,6,7]

Or can is just be "IntendedFor": 5,6,7

Thanks for the clarification.

Dan

dcm2bids philips dataset error

I tried to run the dcm2bids on a Philips dataset. The current version of the script & config file doesn't take into account multiple echos.

I'm running the script on OSX 10.14.4 (18E226).

Here is my terminal output:


alex-macbook:~ $ dcm2bids -d /Users/alfoi/Desktop/glen -c /Users/alfoi/code/Dcm2Bids/config_spine.txt -p sub-001 -o /Users/alfoi/Desktop/glen
INFO:dcm2bids:--- dcm2bids start ---
INFO:dcm2bids:subprocess: dcm2niix
INFO:dcm2bids:
Chris Rorden's dcm2niiX version v1.0.20180622 (JP2:OpenJPEG) GCC6.1.0 (64-bit MacOS)
usage: dcm2niix [options] <in_folder>
 Options :
  -1..-9 : gz compression level (1=fastest..9=smallest, default 6)
  -b : BIDS sidecar (y/n/o [o=only: no NIfTI], default y)
   -ba : anonymize BIDS (y/n, default y)
  -c : comment stored in NIfTI aux_file (up to 24 characters)
  -d : directory search depth. Convert DICOMs in sub-folders of in_folder? (0..9, default 5)
  -f : filename (%a=antenna  (coil) number, %b=basename, %c=comments, %d=description, %e=echo number, %f=folder name, %i=ID of patient, %j=seriesInstanceUID, %k=studyInstanceUID, %m=manufacturer, %n=name of patient, %p=protocol, %r=instance number, %s=series number, %t=time, %u=acquisition number, %v=vendor, %x=study ID; %z=sequence name; default '%f_%p_%t_%s')
  -g : generate defaults file (y/n/o/i [o=only: reset and write defaults; i=ignore: reset defaults], default n)
  -h : show help
  -i : ignore derived, localizer and 2D images (y/n, default n)
  -l : losslessly scale 16-bit integers to use dynamic range (y/n, default n)
  -m : merge 2D slices from same series regardless of study time, echo, coil, orientation, etc. (y/n, default n)
  -n : only convert this series number - can be used up to 16 times (default convert all)
  -o : output directory (omit to save to input folder)
  -p : Philips precise float (not display) scaling (y/n, default y)
  -r : rename instead of convert DICOMs (y/n, default n)
  -s : single file mode, do not convert other images in folder (y/n, default n)
  -t : text notes includes private patient details (y/n, default n)
  -u : up-to-date check
  -v : verbose (n/y or 0/1/2 [no, yes, logorrheic], default 0)
  -x : crop (y/n, default n)
  -z : gz compress images (y/i/n/3, default y) [y=pigz, i=internal:miniz, n=no, 3=no,3D]
 Defaults file : /Users/alfoi/.dcm2nii.ini
 Examples :
  dcm2niix /Users/chris/dir
  dcm2niix -c "my comment" /Users/chris/dir
  dcm2niix -o /users/cr/outdir/ -z y ~/dicomdir
  dcm2niix -f %p_%s -b y -ba n ~/dicomdir
  dcm2niix -f mystudy%s ~/dicomdir
  dcm2niix -o "~/dir with spaces/dir" ~/dicomdir

INFO:dcm2bids:dcm2niix:version: v1.0.20180622
INFO:dcm2bids:participant: sub-001
INFO:dcm2bids:session: None
INFO:dcm2bids:config: /Users/alfoi/code/Dcm2Bids/config_spine.txt
INFO:dcm2bids:BIDS directory: /Users/alfoi/Desktop/glen
INFO:dcm2bids:
INFO:dcm2bids:Old dcm2niix output found
INFO:dcm2bids:Use --forceDcm2niix to rerun the conversion
INFO:dcm2bids:
INFO:dcm2bids:Sidecars matching:
INFO:dcm2bids:NO MATCH        1001_glen_WIP_GRE-ME_5..20171128160324_e1.json
INFO:dcm2bids:NO MATCH        1001_glen_WIP_GRE-ME_5..20171128160324_e2.json
INFO:dcm2bids:NO MATCH        1001_glen_WIP_GRE-ME_5..20171128160324_e3.json
INFO:dcm2bids:NO MATCH        101_glen_WIP_SURVEY_CL..8160324_e1_i00001.json
INFO:dcm2bids:NO MATCH        101_glen_WIP_SURVEY_CL..1128160324_i00004.json
INFO:dcm2bids:NO MATCH        101_glen_WIP_SURVEY_CL..1128160324_i00007.json
INFO:dcm2bids:NO MATCH        201_glen_WIP_T1w_SENSE_20171128160324.json
INFO:dcm2bids:NO MATCH        301_glen_WIP_T2w_SENSE_20171128160324.json
INFO:dcm2bids:NO MATCH        401_glen_WIP_DWI_CLEAR_20171128160324.json
INFO:dcm2bids:NO MATCH        402_glen_facFAc_20171128160324_e1.json
INFO:dcm2bids:NO MATCH        501_glen_WIP_GRE-MT_Pr..20171128160324_e1.json
INFO:dcm2bids:NO MATCH        701_glen_WIP_GRE-ME_CLEAR_20171128160324_e1.json
INFO:dcm2bids:NO MATCH        701_glen_WIP_GRE-ME_CLEAR_20171128160324_e2.json
INFO:dcm2bids:NO MATCH        701_glen_WIP_GRE-ME_CLEAR_20171128160324_e3.json
INFO:dcm2bids:NO MATCH        801_glen_WIP_GRE-MT_SENSE_20171128160324.json
INFO:dcm2bids:
INFO:dcm2bids:Checking if a description matches several sidecars ...
INFO:dcm2bids:
INFO:dcm2bids:moving acquisitions into BIDS output directory

Here is my config file:


{
    "descriptions": [
        {
            "dataType": "anat",
            "modalityLabel": "T1w",
            "criteria": {
                "SeriesDescription": "T1w",
                "ProtocolName": "*T1w"
            }
        },
        {
            "dataType": "anat",
            "modalityLabel": "T2w",
            "criteria": {
                "SeriesDescription": "T2w",
                "ProtocolName": "*T2w"
            }
        },
        {
            "dataType": "anat",
            "modalityLabel": "MTS",
            "customLabels": "acq-T1w",
            "criteria": {
                "SeriesDescription": "GRE-T1*",
                "ProtocolName": "*GRE-T1*"
            }
        },
        {
            "dataType": "anat",
            "modalityLabel": "MTS",
            "customLabels": "acq-MT",
            "criteria": {
                "Manufacturer": "Philips",
                "SeriesDescription": "GRE-MT",
                "ProtocolName": "WIP_GRE-MT"
            }
        }, 
        {
            "dataType": "anat",
            "modalityLabel": "MTS",
            "customLabels": "acq-MTon",
            "criteria": {
                "SeriesDescription": "GRE-MT1",
                "ProtocolName": "GRE-MT1"
            }
        },
        {
            "dataType": "anat",
            "modalityLabel": "MTS",
            "customLabels": "acq-MToff",
            "criteria": {
                "SeriesDescription": "GRE-MT0",
                "ProtocolName": "GRE-MT0"
            }
        },

        {
            "dataType": "anat",
            "modalityLabel": "T2star",
            "criteria": {
                "Manufacturer": "Philips",
                "SeriesDescription": "sSUM",
                "ProtocolName": "sSUM"
            }
        },         
        {
            "dataType": "anat",
            "modalityLabel": "T2star",
            "criteria": {
                "SeriesDescription": "GRE-ME",
                "ProtocolName": "GRE-ME"
            }
        },    
        {
            "dataType": "dwi",
            "modalityLabel": "dwi",
            "criteria": {
                "SeriesDescription": "DWI",
                "ProtocolName": "*DWI"
                }
        },    
        {
            "dataType": "dwi",
            "modalityLabel": "acq-b0_dwi",
            "criteria": {
                "SeriesDescription": "DWI_b0",
                "ProtocolName": "DWI_b0"
                }
        }
    ]
}

@cbedetti I will send you the dataset in a private email.

module 'os' has no attribute 'EX_OK'

Hi all, when dcm2niix and dcm2bids are already installed, I tried to run dcm2bids_scaffold.

However, something went wrong.

$ dcm2bids_scaffold
Traceback (most recent call last):
File "D:/ProgramData/Miniconda3/envs/dcm2bids/Scripts/dcm2bids_scaffold", line 104, in
sys.exit(main())
File "D:/ProgramData/Miniconda3/envs/dcm2bids/Scripts/dcm2bids_scaffold", line 100, in main
return os.EX_OK
AttributeError: module 'os' has no attribute 'EX_OK'
(dcm2bids)

And I found this issus, so I was wondering maybe this error are also because of non-linux system (I'm using windows)? di/vladiate#49

So dose anyone meet same problem?

-p argument question

Hi!
In the usage example in your readme you omit the -p argument. When I try to do this I get the following:
dcm2bids: error: the following arguments are required: -p/--participant
What does the -p argument do and how should I use it?

Jooh's fork error

Hi, tried to run yours, jooh, but I get this error:

Traceback (most recent call last):
  File "/home/egarza/MRI/apps/Dcm2Bids/scripts/dcm2bids", line 93, in <module>
    sys.exit(main())
  File "/home/egarza/MRI/apps/Dcm2Bids/scripts/dcm2bids", line 88, in main
    app = Dcm2bids(**vars(args))
  File "/home/egarza/MRI/apps/Dcm2Bids/dcm2bids/dcm2bids.py", line 29, in __init__
    self.dicomdir = os.path.join(outputdir,'tmp_dcm2bids')
  File "/usr/local/bin/miniconda/lib/python2.7/posixpath.py", line 77, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'
Traceback (most recent call last):
  File "/home/egarza/MRI/apps/Dcm2Bids/scripts/dcm2bids", line 93, in <module>
    sys.exit(main())
  File "/home/egarza/MRI/apps/Dcm2Bids/scripts/dcm2bids", line 88, in main
    app = Dcm2bids(**vars(args))
  File "/home/egarza/MRI/apps/Dcm2Bids/dcm2bids/dcm2bids.py", line 29, in __init__
    self.dicomdir = os.path.join(outputdir,'tmp_dcm2bids')
  File "/usr/local/bin/miniconda/lib/python2.7/posixpath.py", line 77, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'
Traceback (most recent call last):
  File "/home/egarza/MRI/apps/Dcm2Bids/scripts/dcm2bids", line 93, in <module>
    sys.exit(main())
  File "/home/egarza/MRI/apps/Dcm2Bids/scripts/dcm2bids", line 88, in main
    app = Dcm2bids(**vars(args))
  File "/home/egarza/MRI/apps/Dcm2Bids/dcm2bids/dcm2bids.py", line 29, in __init__
    self.dicomdir = os.path.join(outputdir,'tmp_dcm2bids')
  File "/usr/local/bin/miniconda/lib/python2.7/posixpath.py", line 77, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'

Version of dcm2niix should be checked along with config file

With the evolution of dcm2niix, some config files might become obsolete, making it difficult to debug if users have conversion problem (is it dcm2niix? is it their OS? is it their syntax? is it dcm2bids? etc.).

One workaround would be to specify dcm2niix version that was used to generate a config file.

Below is an example to reproduce the issue:

Version dcm2bids (from Pypi): (1.1.8)

Dicom dataset:
https://www.dropbox.com/s/tis1i50egxo1b4q/20180611_tokyo_prisma.zip?dl=0

Config file:
config_spine.txt

Syntax:

dcm2bids -d 20180611_prisma/DICOM/ -p sub-99 -c config_spine.txt

Output with dcm2niix v1.0.20181125:

dcm2bids -d 20180611_prisma/DICOM/ -p sub-99 -c config_spine.txt 
INFO:dcm2bids:--- dcm2bids start ---
INFO:dcm2bids:subprocess: dcm2niix
INFO:dcm2bids:
Chris Rorden's dcm2niiX version v1.0.20181125  (JP2:OpenJPEG) (JP-LS:CharLS) Clang8.1.0 (64-bit MacOS)
usage: dcm2niix [options] <in_folder>
 Options :
  -1..-9 : gz compression level (1=fastest..9=smallest, default 6)
  -b : BIDS sidecar (y/n/o [o=only: no NIfTI], default y)
   -ba : anonymize BIDS (y/n, default y)
  -c : comment stored in NIfTI aux_file (up to 24 characters)
  -d : directory search depth. Convert DICOMs in sub-folders of in_folder? (0..9, default 5)
  -f : filename (%a=antenna (coil) name, %b=basename, %c=comments, %d=description, %e=echo number, %f=folder name, %i=ID of patient, %j=seriesInstanceUID, %k=studyInstanceUID, %m=manufacturer, %n=name of patient, %p=protocol, %r=instance number, %s=series number, %t=time, %u=acquisition number, %v=vendor, %x=study ID; %z=sequence name; default '%3s_%f_%p_%t')
  -g : generate defaults file (y/n/o/i [o=only: reset and write defaults; i=ignore: reset defaults], default n)
  -h : show help
  -i : ignore derived, localizer and 2D images (y/n, default n)
  -l : losslessly scale 16-bit integers to use dynamic range (y/n, default n)
  -m : merge 2D slices from same series regardless of study time, echo, coil, orientation, etc. (y/n, default n)
  -n : only convert this series number - can be used up to 16 times (default convert all)
  -o : output directory (omit to save to input folder)
  -p : Philips precise float (not display) scaling (y/n, default y)
  -r : rename instead of convert DICOMs (y/n, default n)
  -s : single file mode, do not convert other images in folder (y/n, default n)
  -t : text notes includes private patient details (y/n, default n)
  -u : up-to-date check
  -v : verbose (n/y or 0/1/2 [no, yes, logorrheic], default 0)
  -x : crop (y/n, default n)
  -z : gz compress images (y/i/n/3, default y) [y=pigz, i=internal:zlib, n=no, 3=no,3D]
 Defaults file : /Users/julien/.dcm2nii.ini
 Examples :
  dcm2niix /Users/chris/dir
  dcm2niix -c "my comment" /Users/chris/dir
  dcm2niix -o /users/cr/outdir/ -z y ~/dicomdir
  dcm2niix -f %p_%s -b y -ba n ~/dicomdir
  dcm2niix -f mystudy%s ~/dicomdir
  dcm2niix -o "~/dir with spaces/dir" ~/dicomdir

INFO:dcm2bids:dcm2niix:version: v1.0.20181125
INFO:dcm2bids:participant: sub-99
INFO:dcm2bids:session: None
INFO:dcm2bids:config: /Users/julien/Desktop/config_spine.txt
INFO:dcm2bids:BIDS directory: /Users/julien/Desktop
INFO:dcm2bids:
INFO:dcm2bids:--- running dcm2niix ---
INFO:dcm2bids:subprocess: dcm2niix -b y -ba y -z y -f '%3s_%f_%p_%t' -o /Users/julien/Desktop/tmp_dcm2bids/sub-99 20180611_prisma/DICOM/
INFO:dcm2bids:
Chris Rorden's dcm2niiX version v1.0.20181125  (JP2:OpenJPEG) (JP-LS:CharLS) Clang8.1.0 (64-bit MacOS)
Found 398 DICOM file(s)
Warning: interpolated protocol 'Localizer' may be unsuitable for dwidenoise/mrdegibbs. 20180611_prisma/DICOM/20180611/18550000/55350010/37578694
Warning: interpolated protocol 'Localizer' may be unsuitable for dwidenoise/mrdegibbs. 20180611_prisma/DICOM/20180611/18550000/55350010/37578587
Convert 192 DICOM as /Users/julien/Desktop/tmp_dcm2bids/sub-99/003_DICOM_T1w_20180611174332 (260x320x192x1)
compress: "/Applications/mricron/pigz" -n -f -6 "/Users/julien/Desktop/tmp_dcm2bids/sub-99/003_DICOM_T1w_20180611174332.nii"
slices stacked despite varying acquisition numbers (if this is not desired recompile with 'mySegmentByAcq')
Warning: Weird CSA 'ProtocolSliceNumber' (System/Miscellaneous/ImageNumbering reversed): VALIDATE SLICETIMING AND BVECS
Saving 35 DTI gradients. Validate vectors.
Convert 35 DICOM as /Users/julien/Desktop/tmp_dcm2bids/sub-99/005_DICOM_DWI_20180611174332 (96x36x15x35)
compress: "/Applications/mricron/pigz" -n -f -6 "/Users/julien/Desktop/tmp_dcm2bids/sub-99/005_DICOM_DWI_20180611174332.nii"
Convert 64 DICOM as /Users/julien/Desktop/tmp_dcm2bids/sub-99/004_DICOM_T2w_20180611174332 (320x320x64x1)
compress: "/Applications/mricron/pigz" -n -f -6 "/Users/julien/Desktop/tmp_dcm2bids/sub-99/004_DICOM_T2w_20180611174332.nii"
Convert 22 DICOM as /Users/julien/Desktop/tmp_dcm2bids/sub-99/007_DICOM_GRE-MT0_20180611174332 (256x256x22x1)
compress: "/Applications/mricron/pigz" -n -f -6 "/Users/julien/Desktop/tmp_dcm2bids/sub-99/007_DICOM_GRE-MT0_20180611174332.nii"
Convert 22 DICOM as /Users/julien/Desktop/tmp_dcm2bids/sub-99/008_DICOM_GRE-T1w_20180611174332 (256x256x22x1)
compress: "/Applications/mricron/pigz" -n -f -6 "/Users/julien/Desktop/tmp_dcm2bids/sub-99/008_DICOM_GRE-T1w_20180611174332.nii"
slices not stacked: orientation varies (vNav or localizer?) [1 0 0 0 0 -1] != [0 1 0 0 0 -1]
Convert 5 DICOM as /Users/julien/Desktop/tmp_dcm2bids/sub-99/002_DICOM_Localizer_20180611174332_i00004 (512x512x5x1)
compress: "/Applications/mricron/pigz" -n -f -6 "/Users/julien/Desktop/tmp_dcm2bids/sub-99/002_DICOM_Localizer_20180611174332_i00004.nii"
Warning: Weird CSA 'ProtocolSliceNumber' (System/Miscellaneous/ImageNumbering reversed): VALIDATE SLICETIMING AND BVECS
Convert 15 DICOM as /Users/julien/Desktop/tmp_dcm2bids/sub-99/009_DICOM_GRE-ME_20180611174332 (448x448x15x1)
compress: "/Applications/mricron/pigz" -n -f -6 "/Users/julien/Desktop/tmp_dcm2bids/sub-99/009_DICOM_GRE-ME_20180611174332.nii"
Convert 22 DICOM as /Users/julien/Desktop/tmp_dcm2bids/sub-99/006_DICOM_GRE-MT1_20180611174332 (256x256x22x1)
compress: "/Applications/mricron/pigz" -n -f -6 "/Users/julien/Desktop/tmp_dcm2bids/sub-99/006_DICOM_GRE-MT1_20180611174332.nii"
Convert 5 DICOM as /Users/julien/Desktop/tmp_dcm2bids/sub-99/001_DICOM_Localizer_20180611174332_i00004 (512x512x5x1)
compress: "/Applications/mricron/pigz" -n -f -6 "/Users/julien/Desktop/tmp_dcm2bids/sub-99/001_DICOM_Localizer_20180611174332_i00004.nii"
Warning: Weird CSA 'ProtocolSliceNumber' (System/Miscellaneous/ImageNumbering reversed): VALIDATE SLICETIMING AND BVECS
Convert 3 DICOM as /Users/julien/Desktop/tmp_dcm2bids/sub-99/002_DICOM_Localizer_20180611174332_i00001 (512x512x3x1)
compress: "/Applications/mricron/pigz" -n -f -6 "/Users/julien/Desktop/tmp_dcm2bids/sub-99/002_DICOM_Localizer_20180611174332_i00001.nii"
Warning: Weird CSA 'ProtocolSliceNumber' (System/Miscellaneous/ImageNumbering reversed): VALIDATE SLICETIMING AND BVECS
Convert 3 DICOM as /Users/julien/Desktop/tmp_dcm2bids/sub-99/001_DICOM_Localizer_20180611174332_i00001 (512x512x3x1)
compress: "/Applications/mricron/pigz" -n -f -6 "/Users/julien/Desktop/tmp_dcm2bids/sub-99/001_DICOM_Localizer_20180611174332_i00001.nii"
Conversion required 1.627434 seconds (0.474355 for core code).

INFO:dcm2bids:
INFO:dcm2bids:Sidecars matching:
INFO:dcm2bids:NO MATCH        001_DICOM_Localizer_20180611174332_i00001.json
INFO:dcm2bids:NO MATCH        001_DICOM_Localizer_20180611174332_i00004.json
INFO:dcm2bids:NO MATCH        002_DICOM_Localizer_20180611174332_i00001.json
INFO:dcm2bids:NO MATCH        002_DICOM_Localizer_20180611174332_i00004.json
INFO:dcm2bids:MATCH           003_DICOM_T1w_20180611174332.json
INFO:dcm2bids:MATCH           004_DICOM_T2w_20180611174332.json
INFO:dcm2bids:MATCH           005_DICOM_DWI_20180611174332.json
INFO:dcm2bids:MATCH           006_DICOM_GRE-MT1_20180611174332.json
INFO:dcm2bids:MATCH           007_DICOM_GRE-MT0_20180611174332.json
INFO:dcm2bids:MATCH           008_DICOM_GRE-T1w_20180611174332.json
INFO:dcm2bids:MATCH           009_DICOM_GRE-ME_20180611174332.json
INFO:dcm2bids:
INFO:dcm2bids:Checking if a description matches several sidecars ...
INFO:dcm2bids:
INFO:dcm2bids:moving acquisitions into BIDS output directory

Output with dcm2niix v1.0.20170130

dcm2bids -d 20180611_prisma/DICOM/ -p sub-99 -c config_spine.txt 
INFO:dcm2bids:--- dcm2bids start ---
INFO:dcm2bids:subprocess: dcm2niix
INFO:dcm2bids:
Compression will be faster with /usr/local/bin/pigz
Chris Rorden's dcm2niiX version v1.0.20170130 (openJPEG build) (64-bit MacOS)
usage: dcm2niix [options] <in_folder>
 Options :
  -b : BIDS sidecar (y/n, default n)
  -f : filename (%a=antenna  (coil) number, %c=comments, %d=description, %e echo number, %f=folder name, %i ID of patient, %m=manufacturer, %n=name of patient, %p=protocol, %s=series number, %t=time, %u=acquisition number, %z sequence name; default '%3s_%f_%p_%t')
  -h : show help
  -m : merge 2D slices from same series regardless of study time, echo, coil, orientation, etc. (y/n, default n)
  -o : output directory (omit to save to input folder)
  -s : single file mode, do not convert other images in folder (y/n, default n)
  -t : text notes includes private patient details (y/n, default n)
  -v : verbose (y/n, default n)
  -x : crop (y/n, default n)
  -z : gz compress images (y/i/n, default y) [y=pigz, i=internal, n=no]
 Defaults file : /Users/julien/.dcm2nii.ini
 Examples :
  dcm2niix /Users/chris/dir
  dcm2niix -o /users/cr/outdir/ -z y ~/dicomdir
  dcm2niix -f mystudy%s ~/dicomdir
  dcm2niix -o "~/dir with spaces/dir" ~/dicomdir

INFO:dcm2bids:dcm2niix:version: v1.0.20170130
INFO:dcm2bids:participant: sub-99
INFO:dcm2bids:session: None
INFO:dcm2bids:config: /Users/julien/Desktop/config_spine.txt
INFO:dcm2bids:BIDS directory: /Users/julien/Desktop
INFO:dcm2bids:
INFO:dcm2bids:--- running dcm2niix ---
INFO:dcm2bids:subprocess: dcm2niix -b y -ba y -z y -f '%3s_%f_%p_%t' -o /Users/julien/Desktop/tmp_dcm2bids/sub-99 20180611_prisma/DICOM/
INFO:dcm2bids:
Compression will be faster with /usr/local/bin/pigz
Chris Rorden's dcm2niiX version v1.0.20170130 (openJPEG build) (64-bit MacOS)
Found 398 DICOM image(s)
Convert 192 DICOM as /Users/julien/Desktop/tmp_dcm2bids/sub-99/003_DICOM_T1w_20180611174332 (260x320x192x1)
slices stacked despite varying acquisition numbers (if this is not desired please recompile)
Warning: Weird CSA 'ProtocolSliceNumber' (14): SPATIAL, SLICE-ORDER AND DTI TRANSFORMS UNTESTED
Warning: DTI gradient directions only tested for axial (transverse) acquisitions. Please validate bvec files.
Convert 35 DICOM as /Users/julien/Desktop/tmp_dcm2bids/sub-99/005_DICOM_DWI_20180611174332 (96x36x15x35)
Convert 64 DICOM as /Users/julien/Desktop/tmp_dcm2bids/sub-99/004_DICOM_T2w_20180611174332 (320x320x64x1)
Convert 22 DICOM as /Users/julien/Desktop/tmp_dcm2bids/sub-99/007_DICOM_GRE-MT0_20180611174332 (256x256x22x1)
Convert 22 DICOM as /Users/julien/Desktop/tmp_dcm2bids/sub-99/008_DICOM_GRE-T1w_20180611174332 (256x256x22x1)
slices not stacked: orientation varies (localizer?) [1 0 0 0 0 -1] != [0 1 0 0 0 -1]
Convert 5 DICOM as /Users/julien/Desktop/tmp_dcm2bids/sub-99/002_DICOM_Localizer_20180611174332 (512x512x5x1)
Warning: Weird CSA 'ProtocolSliceNumber' (14): SPATIAL, SLICE-ORDER AND DTI TRANSFORMS UNTESTED
Convert 15 DICOM as /Users/julien/Desktop/tmp_dcm2bids/sub-99/009_DICOM_GRE-ME_20180611174332 (448x448x15x1)
Convert 22 DICOM as /Users/julien/Desktop/tmp_dcm2bids/sub-99/006_DICOM_GRE-MT1_20180611174332 (256x256x22x1)
slices not stacked: orientation varies (localizer?) [1 0 0 0 0 -1] != [0 1 0 0 0 -1]
Convert 5 DICOM as /Users/julien/Desktop/tmp_dcm2bids/sub-99/001_DICOM_Localizer_20180611174332 (512x512x5x1)
slices not stacked: orientation varies (localizer?) [0 1 0 0 0 -1] != [1 0 0 0 0 -1]
Warning: Weird CSA 'ProtocolSliceNumber' (5): SPATIAL, SLICE-ORDER AND DTI TRANSFORMS UNTESTED
Convert 3 DICOM as /Users/julien/Desktop/tmp_dcm2bids/sub-99/002_DICOM_Localizer_20180611174332a (512x512x3x1)
slices not stacked: orientation varies (localizer?) [0 1 0 0 0 -1] != [1 0 0 0 0 -1]
Warning: Weird CSA 'ProtocolSliceNumber' (5): SPATIAL, SLICE-ORDER AND DTI TRANSFORMS UNTESTED
Convert 3 DICOM as /Users/julien/Desktop/tmp_dcm2bids/sub-99/001_DICOM_Localizer_20180611174332a (512x512x3x1)
Conversion required 3.553113 seconds.

INFO:dcm2bids:
INFO:dcm2bids:Sidecars matching:
INFO:dcm2bids:NO MATCH        001_DICOM_Localizer_20180611174332.json
INFO:dcm2bids:NO MATCH        001_DICOM_Localizer_20180611174332a.json
INFO:dcm2bids:NO MATCH        002_DICOM_Localizer_20180611174332.json
INFO:dcm2bids:NO MATCH        002_DICOM_Localizer_20180611174332a.json
INFO:dcm2bids:NO MATCH        003_DICOM_T1w_20180611174332.json
INFO:dcm2bids:NO MATCH        004_DICOM_T2w_20180611174332.json
INFO:dcm2bids:NO MATCH        005_DICOM_DWI_20180611174332.json
INFO:dcm2bids:NO MATCH        006_DICOM_GRE-MT1_20180611174332.json
INFO:dcm2bids:NO MATCH        007_DICOM_GRE-MT0_20180611174332.json
INFO:dcm2bids:NO MATCH        008_DICOM_GRE-T1w_20180611174332.json
INFO:dcm2bids:NO MATCH        009_DICOM_GRE-ME_20180611174332.json
INFO:dcm2bids:
INFO:dcm2bids:Checking if a description matches several sidecars ...
INFO:dcm2bids:
INFO:dcm2bids:moving acquisitions into BIDS output directory

Feature request: adding information to json

I would like to propose an enhancement: the possibility to add fields with information to the bids json files.

In some cases dcm2niix cannot set all bids fields in the json file, since the info is not available in the dicom headers. One example is the "TaskName" field in (resting state) fMRI. Another may be the "SliceTiming" information, not provided in e.g. Philips dicom.

This information could be provided in the config_dcm2bids.json, e.g.:

{
"dataType": "func",
"modalityLabel": "bold",
"customLabels": "task-rest",
"criteria": {
"SeriesDescription": "fMRI_resting*"
}
"customField": {
"TaskName": "rest"
"SliceTimimg": [0 0.7 1.4 etc...]
}
}

Another example could be:

{
"dataType": "fmap",
"modalityLabel": "fieldmap",
"criteria": {
"SeriesDescription": "B0_map",
"ScanningSequence": "RM"
}
"customField": {
"Units": "Hz"
"IntendFor": "ses-pos2/func/sub-001_ses-pos2_task-rest_bold.nii.gz"
}
}

The "customField" thus contains information to be added in the json, specific for each dicom acquisition. Of course, since the info is not in the dicom, the user is responsible for providing the correct information.

Hope to hear your feedback on this idea.

Best regards,
Stefan.

Proper config file

Hi ...
I'm still struggling with getting to run the Dcm2bids but assuming that I can run it what would be a proper config file for this type of data that attached here? I tried to modify the config file (copied below) but not sure if I'm doing this correctly.

Thank you!
Mahmoud

"descriptions": [
{
"dataType": "anat",
"suffix": "T1w",
"criteria": {
"in": {"SeriesDescription": "T1W_3D"}
}
},
{
"dataType": "anat",
"suffix": "T2w",
"criteria": {
"in": {"SeriesDescription": "T2w_SPC"},
"equal": {"EchoTime": 0.563}
}
},
{
"dataType": "dwi",
"suffix": "dwi",
"customLabels": "b2000-PA",
"criteria": {
"in": {"SeriesDescription": "dMRI_b2000_dir90_PA"}
}
},
{
"dataType": "dwi",
"suffix": "SB",
"customLabels": "b2000-PA",
"criteria": {
"in": {"SeriesDescription": "dMRI_b2000_dir90_PA_SBRef"}
}
},
{
"dataType": "dwi",
"suffix": "dwi",
"customLabels": "b700-AP",
"criteria": {
"in": {"SeriesDescription": "dMRI_b700_dir89_AP"}
}
},
{
"dataType": "dwi",
"suffix": "SB",
"customLabels": "b700-AP",
"criteria": {
"in": {"SeriesDescription": "dMRI_b700_dir89_AP_SBRef"}
}
},
{
"dataType": "func",
"suffix": "bold",
"customLabels": "rest-AP",
"criteria": {
"equal": {"SeriesDescription": "rfMRI_REST_AP"}
}
},
{
"dataType": "func",
"suffix": "SB",
"customLabels": "AP",
"criteria": {
"equal": {"SeriesDescription": "rfMRI_REST_AP_SBRef"}
}
},
{
"dataType": "func",
"suffix": "bold",
"customLabels": "rest-PA",
"criteria": {
"equal": {"SeriesDescription": "rfMRI_REST_PA"}
}
},
{
"dataType": "func",
"suffix": "SB",
"customLabels": "PA",
"criteria": {
"equal": {"SeriesDescription": "rfMRI_REST_PA_SBRef"}
}
}
]

dataset

Issue running dcm2bids

Hello,

I installed dcm2bids using the recommendations from the README document:

git clone https://github.com/cbedetti/Dcm2Bids.git
cd Dcm2Bids
pip install --user .

After making a configuration file, I received an error after running the following command:
dcm2bids -d $dicom_dir -p 1 -c $configuration_file -o $output_dir

Traceback (most recent call last):
  File "/N/u/dlevitas/Karst/.local/bin/dcm2bids", line 87, in <module>
    sys.exit(main())
  File "/N/u/dlevitas/Karst/.local/bin/dcm2bids", line 82, in main
    app = Dcm2bids(**vars(args))
  File "/N/u/dlevitas/Karst/.local/lib/python2.7/site-packages/dcm2bids/dcm2bids.py", line 31, in __init__
    self.config = load_json(config)
  File "/N/u/dlevitas/Karst/.local/lib/python2.7/site-packages/dcm2bids/utils.py", line 12, in load_json
    data = json.load(f)
  File "/N/soft/rhel6/python/2.7.3/lib/python2.7/json/__init__.py", line 278, in load
    **kw)
  File "/N/soft/rhel6/python/2.7.3/lib/python2.7/json/__init__.py", line 326, in loads
    return _default_decoder.decode(s)
  File "/N/soft/rhel6/python/2.7.3/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/N/soft/rhel6/python/2.7.3/lib/python2.7/json/decoder.py", line 382, in raw_decode
    obj, end = self.scan_once(s, idx)
ValueError: Expecting property name: line 56 column 4 (char 1033)

I'm not really sure what the error is referring to, so I'm having trouble determining if the problem's due to how I did the installation.

Dan

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.