Code Monkey home page Code Monkey logo

dicom2nifti's Introduction

dicom2nifti

Python library for converting dicom files to nifti

Author:Arne Brys
Organization:icometrix
Repository:https://github.com/icometrix/dicom2nifti
API documentation:https://icometrix.github.io/dicom2nifti/

Using dicom2nifti

Installation

conda:

conda install -c conda-forge dicom2nifti

pip:

pip install dicom2nifti

To support compressed dicom formats (JPEG, JPEG2000) we use GDCM in combination with pydicom. Please install gdcm as required. https://pydicom.github.io/pydicom/stable/tutorials/installation.html

Updating

conda:

conda update dicom2nifti

pip:

pip install dicom2nifti --upgrade

Usage

Command line

dicom2nifti [-h] [-G] [-r] [-o RESAMPLE_ORDER] [-p RESAMPLE_PADDING] [-M] [-C] [-R] input_directory output_directory

for more information

dicom2nifti -h

From python

Converting a directory with dicom files to nifti files

import dicom2nifti

dicom2nifti.convert_directory(dicom_directory, output_folder, compression=True, reorient=True)

Converting a directory with only 1 series to 1 nifti file

import dicom2nifti

dicom2nifti.dicom_series_to_nifti(original_dicom_directory, output_file, reorient_nifti=True)

Supported data

Most anatomical data for CT and MR should be supported as long as they are in classical dicom files.

Try avoiding "Implicit VR Endian" if possible as this makes converting non anatomical (i.e. DTI, fMRI, ...) much more difficult.

There is some vendor specific support, more specifically for 4D imaging like fMRI and DTI/DKI

Gantry tilted CT

By default support for gantry tilted ct is disabled as we validate image orthogonality. You can explicitly allow gantry tilted data by disabling this validation.

Standard this will result in a nifti file where the gantry tilt is captured by the affine matrix. We also provide the option to resample the data to an orthogonal nifti. For this resampling we use scipy.ndimage.interpolation.affine_transform. You should configure the padding value and spline interpolation order. IMPORTANT NOTE: When using the orthogonal resampling the output nifti will always be reoriented

Command line:

dicom2nifti -G -r -o 1 -p -1000 input_directory output_directory

Python code:

import dicom2nifti
import dicom2nifti.settings as settings

settings.disable_validate_orthogonal()
settings.enable_resampling()
settings.set_resample_spline_interpolation_order(1)
settings.set_resample_padding(-1000)

dicom2nifti.convert_directory(dicom_directory, output_folder)

Inconsistent slice incremement

By default support for inconsistent slice increments is disabled. You can explicitly allow the images but should also use resampling (similar to the gantry tilted support) to avoid geometric distortions due to the inconsistent slice increments. You should configure the padding value and spline interpolation order

Command line:

dicom2nifti -I -r -o 1 -p -1000 input_directory output_directory

Python code:

import dicom2nifti
import dicom2nifti.settings as settings

settings.disable_validate_slice_increment()
settings.enable_resampling()
settings.set_resample_spline_interpolation_order(1)
settings.set_resample_padding(-1000)

dicom2nifti.convert_directory(dicom_directory, output_folder)

Single slice

By default we do not convert single slice images. You can explicitly allow the conversion of single slices.

Command line:

dicom2nifti -S input_directory output_directory

Python code:

import dicom2nifti
import dicom2nifti.settings as settings

settings.disable_validate_slicecount()

dicom2nifti.convert_directory(dicom_directory, output_folder)

GE MR

Anatomical data should all be support. 4D images like fMRI and DTI/DKI are supported.

Siemens MR

Anatomical data should all be support. 4D images like fMRI and DTI/DKI are supported.

Philips MR

For classic dicom files dicom2nifti support anatomical. For classic dicom files 4D images like fMRI and DTI/DKI are supported.

For "Philips Enhanced Dicom" there is no support for "Implicit VR Endian" transfer syntax. For the others we support anatomical and 4D images like fMRI and DTI/DKI.

Hitachi MR

Anatomical data should all be support. 4D images like fMRI and DTI/DKI are NOT supported. Anyone willing to share DTI and/or fMRI dicom form Hitachi scanners please contact us.

Unsupported data

If you encounter unsupported data you can help the development of dicom2nifti by providing a dataset. This dataset should be anonymised (but leave as much of the private fields as possible).

dicom2nifti's People

Contributors

abrys avatar cancan101 avatar dloeckx avatar fmljr avatar meliascosta avatar topspinj 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  avatar  avatar  avatar  avatar  avatar  avatar

dicom2nifti's Issues

Package not usable with pydicom 1.0+

Installed with pip install.

$ dicom2nifti --help
Traceback (most recent call last):
  File "/Users/fedorov/.pyenv/versions/2.7.8/bin/dicom2nifti", line 14, in <module>
    import dicom2nifti.convert_dir as convert_directory
  File "/Users/fedorov/.pyenv/versions/2.7.8/lib/python2.7/site-packages/dicom2nifti/__init__.py", line 20, in <module>
    from .convert_dicom import dicom_series_to_nifti
  File "/Users/fedorov/.pyenv/versions/2.7.8/lib/python2.7/site-packages/dicom2nifti/convert_dicom.py", line 8, in <module>
    import dicom2nifti.patch_pydicom_encodings
  File "/Users/fedorov/.pyenv/versions/2.7.8/lib/python2.7/site-packages/dicom2nifti/patch_pydicom_encodings.py", line 5, in <module>
    import dicom.charset
ImportError: No module named dicom.charset

Maybe convert_directory can return filename of created nifti?

Hi,

thanks for dicom2nifti. I was wondering if you are considering changes for returning the filename of the created nifti file after calling dicom2nifti.convert_directory. My use-case is converting one directory with one series and I want to pass the nifti file reference to some other program for further processing.

Thanks for your time,
Joshy

PS: I can also create a pull request if you want.

Name of the files/hierarchy of the folder

Hello sir or madam,
thanks for the dicom2nifti.
I dont understand how the name of the generated nifti file is saved. When I open the data in RadiAnt oder ITK. I get this ONE "t1_mpr_ns_sag_K..RECO" . But when I use the code line with dicom2nifti.convert_directory, I get "21_tfl3d1_ns" which is the saved name of the file. I dont understand how it comes to this name??

Is there a function. if you want to save the nifti files like it was hierarchically defined in the folder
Meaning
Folder A -> Folder A1: Dicom1
-> Folder A2: Dicom2

And then in the code dicom2nifti.convert_directory(Folder A, Folder B), we have

Folder B -> Folder A1: Nifti1
-> Folder A2: Nifti2

Is it possible to keep this hierarchy?

Thanks

Looping through different dicom folder

**Hi, I am trying to loop through different folders of dicom data and convert them to nifti files. The code converts the first dicom folder to nifti but then throughs in an error (see below)*. if I try to do one folder at a time it works. Will really appreciate help *

Code:
path=os.chdir('/Users/abhinandanbatra/Desktop/xxxx/xxxxx') newpath='/Users/abhinandanbatra/Desktop/yyyy' subfolders=os.listdir(path) print(subfolders) for f in subfolders: dicom2nifti.dicom_series_to_nifti(f, os.path.join(newpath,f+'_label'), reorient_nifti=True)

Error:

FileNotFoundError Traceback (most recent call last)
/anaconda3/lib/python3.7/site-packages/nibabel/loadsave.py in load(filename, **kwargs)
39 try:
---> 40 stat_result = os.stat(filename)
41 except OSError:

FileNotFoundError: [Errno 2] No such file or directory: '/Users/abhinandanbatra/Desktop/pyradiomics/nifti/C6012011_label'

During handling of the above exception, another exception occurred:

FileNotFoundError Traceback (most recent call last)
in ()
7 for f in subfolders:
8 # dicom_input = dicom2nifti.common.read_dicom_directory(f)
----> 9 dicom2nifti.dicom_series_to_nifti(f, os.path.join(newpath,f+'_label'), reorient_nifti=True)
10 # if f.startswith('C6'):
11 # dicom2nifti.dicom_series_to_nifti(f, os.path.join(newpath,f+'_label'), reorient_nifti=True)

/anaconda3/lib/python3.7/site-packages/dicom2nifti/convert_dicom.py in dicom_series_to_nifti(original_dicom_directory, output_file, reorient_nifti)
84 dicom_input = common.read_dicom_directory(dicom_directory)
85
---> 86 return dicom_array_to_nifti(dicom_input, output_file, reorient_nifti)
87
88 except AttributeError as exception:

/anaconda3/lib/python3.7/site-packages/dicom2nifti/convert_dicom.py in dicom_array_to_nifti(dicom_list, output_file, reorient_nifti)
144 # do image reorientation if needed
145 if reorient_nifti:
--> 146 image_reorientation.reorient_image(results['NII_FILE'], results['NII_FILE'])
147 return results
148

/anaconda3/lib/python3.7/site-packages/dicom2nifti/image_reorientation.py in reorient_image(input_image, output_image)
29 # and get the image data in RAS orientation
30 # print 'Reading nifti'
---> 31 image = load(input_image)
32
33 # 4d have a different conversion to 3d

/anaconda3/lib/python3.7/site-packages/dicom2nifti/image_volume.py in load(nifti_file)
41
42 def load(nifti_file):
---> 43 nifti_image = nibabel.load(nifti_file)
44 return ImageVolume(nifti_image)
45

/anaconda3/lib/python3.7/site-packages/nibabel/loadsave.py in load(filename, **kwargs)
40 stat_result = os.stat(filename)
41 except OSError:
---> 42 raise FileNotFoundError("No such file or no access: '%s'" % filename)
43 if stat_result.st_size <= 0:
44 raise ImageFileError("Empty file: '%s'" % filename)

FileNotFoundError: No such file or no access: '/Users/abhinandanbatra/Desktop/pyradiomics/nifti/C6012011_label'

advertise requirements

I only learned about the requirement of gdcmconv (for compressed dicom files) via error messages and looking into the code.

GE Conversion Issues

Traceback (most recent call last):
  File "/usr/src/app/research/projects/brain/scripts/dicom_to_nifti.py", line 201, in convert_directory
    convert_dicom.dicom_array_to_nifti(dicom_input, nifti_file, reorient)  # noqa: E501
  File "/usr/local/lib/python3.5/dist-packages/dicom2nifti/convert_dicom.py", line 135, in dicom_array_to_nifti
    results = convert_ge.dicom_to_nifti(dicom_list, output_file)
  File "/usr/local/lib/python3.5/dist-packages/dicom2nifti/convert_ge.py", line 74, in dicom_to_nifti
    return _4d_to_nifti(grouped_dicoms, output_file)
  File "/usr/local/lib/python3.5/dist-packages/dicom2nifti/convert_ge.py", line 123, in _4d_to_nifti
    full_block = _get_full_block(grouped_dicoms)
  File "/usr/local/lib/python3.5/dist-packages/dicom2nifti/convert_ge.py", line 171, in _get_full_block
    full_block[:, :, :, index] = data_blocks[index]
ValueError: could not broadcast input array from shape (256,256,3) into shape (256,256,2)

Converting Rgb RCBV images

Hi;

I was wondering if it was possible to convert Relative blow volume maps (RGB) to nifti using the software you have created

Crash during resampling when enabled for gantry tilted data

When enabling resampling for gantry tilted data we encounter some crashes.
This is due to trying to run the resampling on non gantry tilted niftis.
Use the general check from the beginning as this seems to perform better than the one in the resampling code

Pixel spacing mixed up in case of non isotropical slices

It seems that the pixel spacing is mixed up in the case of non isotropical slices.

We got some data that seems to be "preprocessed" using "PMOD Technologies" software (don't know anything more about this) and has non-isotropical axial slices as input.

Validation using slicer and horos shows that we mix up the pixelspacing direction in the affines.
This is usually not an issue as we never encounter non isotropical slices

AttributeError: 'Dataset' object has no attribute 'fileobj_type'

get the error "AttributeError: 'Dataset' object has no attribute 'fileobj_type'" when trying to work with a dicom data set. I am perfectly able to open the dataset using pydicom and extracting the array and header infor using for loops.

dataset included

edit: using python 3.7 and dicom2nifti 2.0.5

code bellow:

import dicom2nifti a = r'C:\Users\User\Google Drive\Dissertation\Work\Subjects\sub_01' b = r'C:\Users\User\Google Drive\Dissertation\Work' dicom2nifti.convert_directory(a, b)

error message:

"Unable to read: C:\Users\User\Google Drive\Dissertation\Work\Subjects\sub_01\EXP180105_LYR_SCAN14.MR.SYTSAI_BRAIN.0003.0001.2018.01.05.11.29.40.942370.31044194.IMA
Traceback (most recent call last):
File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\dicom2nifti\convert_dir.py", line 57, in convert_directory
force=dicom2nifti.settings.pydicom_read_force)
File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\dicom2nifti\compressed_dicom.py", line 15, in read_file
if _is_compressed(dicom_file, force):
File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\dicom2nifti\compressed_dicom.py", line 107, in _is_compressed
force=force)
File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\pydicom\filereader.py", line 880, in dcmread
force=force, specific_tags=specific_tags)
File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\pydicom\filereader.py", line 771, in read_partial
is_implicit_VR, is_little_endian)
File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\pydicom\dataset.py", line 1364, in init
Dataset.init(self, dataset)
File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\pydicom\dataset.py", line 177, in init
dict.init(self, *args)
File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\pydicom\dataset.py", line 597, in getitem
self.fileobj_type, self.filename, self.timestamp,
File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\pydicom\dataset.py", line 520, in getattr
return super(Dataset, self).getattribute(name)
AttributeError: 'Dataset' object has no attribute 'fileobj_type'
Unable to read: C:\Users\User\Google Drive\Dissertation\Work\Subjects\sub_01\EXP180105_LYR_SCAN14.MR.SYTSAI_BRAIN.0003.0002.2018.01.05.11.29.40.942370.31044212.IMA"

sub_01.zip

capture1

Filter away duplicate slices

We sometimes get data that contains duplicate slices (same position/data). Probably due to wrong export form scanner/pacs. This results in an "inconsistent slice increment" error however we could automatically filter aways these slices as they have the same position and data.
This way we can convert the data without manual interactions

Address numpy.matrix deprecation

numpy.matrix is being deprecated. Getting the following warning:

dicom2nifti/common.py:540: PendingDeprecationWarning: the matrix subclass is not 
the recommended way to represent matrices or deal with linear algebra (see 
https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). 
Please adjust your code to use regular ndarray.

It's currently being used in:

  • dicom2nifti/common.py
  • dicom2nifti/convert_philips.py
  • dicom2nifti/convert_siemens.py

To avoid pending deprecation warnings, I suggest using numpy.ndarray instead of numpy.matrix.

_get_grouped_dicoms breaking up DICOM volumes

This is ultimately what is causing #25

Here are the ImagePositionPatient (sorted by InstanceNumber):

array([[-107.980637,  -86.787643,  -64.592575],
       [-107.980637,  -87.787643,  -58.192574],
       [-108.080635,  -88.887642,  -51.792572],
       [-108.080635,  -89.98764 ,  -45.39257 ],
       [-108.180634,  -91.087646,  -38.992569],
       [-108.180634,  -92.187637,  -32.592571],
       [-108.28064 ,  -93.287643,  -26.192572],
       [-108.28064 ,  -94.387642,  -19.792572],
       [-108.380638,  -95.387642,  -13.392571],
       [-108.380638,  -96.48764 ,   -6.992572],
       [-108.480637,  -97.587646,   -0.492571],
       [-108.480637,  -98.687645,    5.907429],
       [-108.580635,  -99.787643,   12.307428],
       [-108.580635, -100.887642,   18.70743 ],
       [-108.680634, -101.887642,   25.107428],
       [-108.680634, -102.98764 ,   31.507429],
       [-108.78064 , -104.087639,   37.907425],
       [-108.78064 , -105.187645,   44.307426],
       [-108.880638, -106.287643,   50.707428],
       [-108.880638, -107.387642,   57.10743 ],
       [-108.980637, -108.48764 ,   63.507423],
       [-109.080635, -109.48764 ,   69.907425]])

and the first difference:

array([[ 0.      , -1.      ,  6.400001],
       [-0.099998, -1.099999,  6.400002],
       [ 0.      , -1.099998,  6.400002],
       [-0.099999, -1.100006,  6.400001],
       [ 0.      , -1.099991,  6.399998],
       [-0.100006, -1.100006,  6.399999],
       [ 0.      , -1.099999,  6.4     ],
       [-0.099998, -1.      ,  6.400001],
       [ 0.      , -1.099998,  6.399999],
       [-0.099999, -1.100006,  6.500001],
       [ 0.      , -1.099999,  6.4     ],
       [-0.099998, -1.099998,  6.399999],
       [ 0.      , -1.099999,  6.400002],
       [-0.099999, -1.      ,  6.399998],
       [ 0.      , -1.099998,  6.400001],
       [-0.100006, -1.099999,  6.399996],
       [ 0.      , -1.100006,  6.400001],
       [-0.099998, -1.099998,  6.400002],
       [ 0.      , -1.099999,  6.400002],
       [-0.099999, -1.099998,  6.399993],
       [-0.099998, -1.      ,  6.400002]])

So it gets broken up into 11 stacks of length 2.

Looking at the DICOM file (first one):

(0018, 0050) Slice Thickness                     DS: "5.000000"
(0018, 0088) Spacing Between Slices              DS: "6.500000"
(0020, 0032) Image Position (Patient)            DS: ['-107.980637', '-86.787643', '-64.592575']
(0020, 0037) Image Orientation (Patient)         DS: ['0.998308', '0.055482', '0.017426', ' -0.057589', '0.984418', '0.166145']
(0028, 0030) Pixel Spacing                       DS: ['0.8593634367', '0.8593869209']

_decompress_dicom fails in unintuitive way if gdcmconv not found

If gdcmconv cannot be found, subprocess.check_output is then called with an executable of None leading to this not so useful stack:

/usr/local/lib/python3.5/dist-packages/dicom2nifti/compressed_dicom.py in _decompress_dicom(dicom_file)
    116         gdcmconv_executable = _which('gdcmconv.exe')
    117 
--> 118     subprocess.check_output([gdcmconv_executable, '-w', dicom_file, dicom_file])
    119 
    120 

/usr/lib/python3.5/subprocess.py in check_output(timeout, *popenargs, **kwargs)
    624 
    625     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
--> 626                **kwargs).stdout
    627 
    628 

/usr/lib/python3.5/subprocess.py in run(input, timeout, check, *popenargs, **kwargs)
    691         kwargs['stdin'] = PIPE
    692 
--> 693     with Popen(*popenargs, **kwargs) as process:
    694         try:
    695             stdout, stderr = process.communicate(input, timeout=timeout)

/usr/lib/python3.5/subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds)
    945                                 c2pread, c2pwrite,
    946                                 errread, errwrite,
--> 947                                 restore_signals, start_new_session)
    948         except:
    949             # Cleanup if the child failed starting.

/usr/lib/python3.5/subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session)
   1472                     else:
   1473                         env_list = None  # Use execv instead of execve.
-> 1474                     executable = os.fsencode(executable)
   1475                     if os.path.dirname(executable):
   1476                         executable_list = (executable,)

/usr/lib/python3.5/os.py in fsencode(filename)
    860             return filename.encode(encoding, errors)
    861         else:
--> 862             raise TypeError("expect bytes or str, not %s" % type(filename).__name__)
    863 
    864     def fsdecode(filename):

TypeError: expect bytes or str, not NoneType

Is it possible to convert straight to .nii instead of .nii.gz?

I have a script to rename the .nii.gz files after conversion, but these names do not carry over if I unzip the files with 7-zip, which needs to be done for use with Vivoquant/

There doesn't seem to be a way to unzip the .nii.gz files directly with python, which would solve the problem, and stopping the script midway to have the user unzip everything wouldn't be ideal.

With that in mind, I would like to ask please whether it's possible to set dicom2nifti to convert DICOMs straight into .nii files? Or, alternatively, whether such functionality could be added in the future?

Thank you for your time.

Logger changed with on import

Logger is changed on importing the module

logger = logging.getLogger(__name__)
handler = logging.StreamHandler(sys.stdout)
handler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(message)s'))
logger.addHandler(handler)
logger.setLevel(logging.WARNING)
.

This means that if I use dicom2nifti rather than running as a script, the logger is affected. Better would be to just set logger from runnable scripts.

Make dti bval/bvec more uniform

Currently it seems that we have a mixture of BVEC in both world and image coordinates. We should make this uniform. It would also be nice that we can switch between them using the configurations.

Add more documentation for errors and settings

Add a section about error codes and settings to the documentation:
For the errors explain what they mean and how to solve and work around them.
For the settings explain what they do.

Conversion process should not rely on InstanceNumber

Problem 1: InstanceNumber is Type 2 attribute - it can be missing. As of current version of dicom2nifti, missing InstanceNumber results in no output produced.

Problem 2: There is also no hard rule that requires InstanceNumber to establish the spatial ordering of the frames. The only reliable way to sort instances and reconstruct volume is to sort them using Image Position (Patient) and Image Orientation (Patient) (also see related discussion in http://dclunie.blogspot.com/2013/10/how-thick-am-i-sad-story-of-lonely-slice.html), and this approach is currently not implemented in the tool.

Speaking for myself, until this issue is resolved, it is hard to seriously consider using dicom2nifti.

DeprecationWarning: invalid escape sequence \s

I get the following DepracationWarning from convert_dir.py:

.../dicom2nifti/convert_dir.py:147: DeprecationWarning: invalid escape sequence \w
.../dicom2nifti/convert_dir.py:148: DeprecationWarning: invalid escape sequence \s

To avoid these warnings, regex should be a raw string:

cleaned_filename = re.sub(r'[^\w\s-]', '', cleaned_filename.strip().lower())
cleaned_filename = re.sub(r'[-\s]+', '-', cleaned_filename)

overflow for signed data where BitsStored is lower than BitsAllocated

For some Hitachi mri data it became apparent that there is an overflow issue.
Some investigation lead to a but in pydicom where it does not seem to handle cases where bitsstored and bitsallocated do not match. The overflow occurs because the for example a 12 bit signed integer is stored in a 16 bit space. As the sign bit is the most significant bit (12) we cannot read this data as if it where 16 bits.

We should:

  • Provide a workaround
  • Report a bug with pydicom

Better hitachi support

Implement structure to further support hitachi data.
We currently support anatomical data but we can already implement the vendor specific structure, tests and documentation.

make writing the output_file optional

for use in certain scenarios it would be great to just return the nibabel object instead of writing to a file. perhaps the output_file can be turned into a keyword argument and if set to None will return an image rather than a path to a file.

Some adni data cannot be converted

Some dicom data from adni cannot be converted like 130_S_2403.
This is possibly due to wrong anonimisation however we could work around this

Inconsistent slice increment

I have a large group of DICOM series and due to some acquisition rounding errors two series have an inconsistent slice increment. Unfortunately, it is impossible for me to redo the acquisition so i was hoping i could fix it during the conversion. Is there any way to increase the error tolerance for the conversion?

Because it is probably introduced due to rounding the error is extremely small, so i would say it shouldn't really matter for the conversion.

Add additional support for gantry tilted CT

It would be great to have additional support for gantry tilted CT.
We currently support gantry tilted ct by taking it into account in the affine headers, however for certain situations a resampled orthogonal image is prefered.
Adding an option to resample the data would be great.

Invalid Affines when First and Last Position are the Same

I have some GE files for which the first and last sorted dicoms have the same image position. This leads to an invalid affine (a column of all 0s).

The issue is that all steps are 0:

step = (image_pos - last_image_pos) / (1 - len(sorted_dicoms))
affine = numpy.matrix([[-image_orient1[0] * delta_r, -image_orient2[0] * delta_c, -step[0], -image_pos[0]],
[-image_orient1[1] * delta_r, -image_orient2[1] * delta_c, -step[1], -image_pos[1]],
[image_orient1[2] * delta_r, image_orient2[2] * delta_c, step[2], image_pos[2]],
[0, 0, 0, 1]])

This can perhaps just be a better error rather than trying to construct the nifti file.

Resampling?

Can I resample the 3D brain MR data to 1mm1mm1mm? What is command for it?

Overflow issue

In certain cases (extremely rare) there seems to be an overflow issue.

GDCMCONV not found

Hi! I'm trying to convert a DICOM directory to a nifti file with the function dicom2nifti.dicom_series_to_nifti but I always get this error:
ConversionError: GDCMCONV_NOT_FOUND

Can anyone tell me the reason and how I can solve it? I really appreciate any help you can provide.

Hanging gantry tilt resampling

The resampling code seems to hang in some cases.
The issue is that we assume the image to be oriented correctly however we currently do the image reorientation after the resampling. This should be the other way around.

Generic multiframe DICOMS not Supported

Right now it looks like the only multiframe DICOMs that are supported are those from Philips. There are a bunch of example (generic) multiframe DICOMs that can be found here: ftp://medical.nema.org/MEDICAL/Dicom/Multiframe/MR/

The DICOM format for multiframe is described here:

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.