Code Monkey home page Code Monkey logo

nifti-image-converter's People

Contributors

alexlaurence avatar aviogit avatar ferasaltwal avatar monjoybme 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

nifti-image-converter's Issues

Iterate with nii2png

Hello 🙂!
Great program ! I understood how to use it from the terminal only I have a large number of convert exams and I would have liked to know how I could iterate on it? It does not seem to me that this is possible via the terminal?

Error running code.

I am working in Google colaboratory
I installed using pip install nii2png command, i was able to do it successfully.
then i ran $ python3 nii2png.py -i /content/MICCAI_BraTS_2019_Data_Training/HGG/BraTS19_2013_10_1/BraTS19_2013_10_1_flair.nii -o /content/output_nifti_png/
and it gave an error as
/bin/bash: nii2png.py: command not found
what should i do?

Matlab Error

Hi there!

I noticed in your nii2png matlab program there was an error on line 173. You forgot to change the increment name from i to current_slice causing it to stay in an infinite loop! Simple fix.

ModuleNotFoundError: No module named '_bz2'

I am using python 3.7 using the following packages in python virtual environment

Package Version


nibabel 2.4.1
numpy 1.16.4
pip 19.1.1
scipy 1.3.0
setuptools 40.8.0
six 1.12.0

But, I get the bellow error :

$ python nii2png.py -i /home/mike/Downloads/dgan/0001.nii -o test.png
Traceback (most recent call last):
  File "nii2png.py", line 14, in <module>
    import scipy, numpy, shutil, os, nibabel
  File "/home/mike/Downloads/dgan/venv37/lib/python3.7/site-packages/nibabel/__init__.py", line 51, in <module>
    from . import analyze as ana
  File "/home/mike/Downloads/dgan/venv37/lib/python3.7/site-packages/nibabel/analyze.py", line 87, in <module>
    from .volumeutils import (native_code, swapped_code, make_dt_codes,
  File "/home/mike/Downloads/dgan/venv37/lib/python3.7/site-packages/nibabel/volumeutils.py", line 23, in <module>
    from .openers import Opener, BZ2File
  File "/home/mike/Downloads/dgan/venv37/lib/python3.7/site-packages/nibabel/openers.py", line 16, in <module>
    from bz2 import BZ2File
  File "/usr/local/lib/python3.7/bz2.py", line 19, in <module>
    from _bz2 import BZ2Compressor, BZ2Decompressor
ModuleNotFoundError: No module named '_bz2'

Contrast settings

I need help with preprocessing medical image data.

I have 100 nifti images.

I want to extract 5 slices from each of these as jpegs.

However, I work in a particular contrast setting with my nifti files when I segment them. How do I ensure that the jpeg file is in my contrast window?

For eg, I open my nifti in ITK snap and change the window to 60-360 and look at the visibility in that setting. This is lost on conversion though.

Is there any way to do this via your software or otherwise? Thanks

nibabel.filebasedimages.ImageFileError: Cannot work out file type of

Why i got this error?

Traceback (most recent call last):
File "nii2png.py", line 157, in
main(sys.argv[1:])
File "nii2png.py", line 38, in main
image_array = nibabel.load(inputfile).get_data()
File "C:\Users\rit\Anaconda3\lib\site-packages\nibabel\loadsave.py", line 56, in load
filename)
nibabel.filebasedimages.ImageFileError: Cannot work out file type of

Support for 2D nifti files?

Hello,
I was trying to use that script for an output image of ANTS.
My nifti file is 2D (only has 1 slice). Maybe one can add this functionallty
Thank you

Incorrect scale after image convert

The output image dimension for coronal and sagittal (x and y axis) were all squeezed to incorrect shape. In my case, the 512x512 image becomes 512x120. Is there any way to ensure the output scale or dimension? Really appreciate if anyone could help. I have been finding a solution for days with no luck. Thank you.

Getting this error by using in Matlab version of this repo?

Hello sir I am using repo and here I am getting stuck what is means and what is the proper solution of this error and furthermore please give me suggestion that whether I would solve this error using different data file?
I am using ADNI dataset and my extension is in .nii.
Thanks in advance
Error:
User selected C:\Users\Ali ktk\Desktop\AD Codes\NIfTI-Image-Converter-0.2.9.9\NIfTI-Image-Converter-0.2.9.9\nii\002_S_0413.nii
Error using affine3d/set.T (line 340)
The final column of an affine transformation matrix must consist of zeroes, except for a one in the last row.

Error in affine3d (line 117)
self.T = A;

Error in images.internal.nifti.niftiImage/getXForm (line 506)
xform = affine3d([R zeros(3,1); T 1]');

Error in images.internal.nifti.niftiImage/simplifyStruct (line 162)
[XformName, Xform] = self.getXForm();

Error in niftiinfo (line 50)
simpleStruct = NV.simplifyStruct();

Error in nii2png (line 27)
image_info = niftiinfo(fullfile(path,file));

NIFTI images (MRI, DTI, and PET) from ADNI database to jpg

I have the dataset with four classes . I want to convert the NIFTI images to jpg to develop a model for classification

I am still debugging this segments of the code:
base_path=os.path.abspath(os.path.dirname(file))
parser = argparse.ArgumentParser(description='Arguments for input and output files')
parser.add_argument('--input_path', type=str, default = base_path, help='Path of the input files')
parser.add_argument('--rotation_angle', type=int, default = 90, help='Rotation degree, i.e., 90°, 180°, 270°, default value is 90°')
args = parser.parse_args()
input_path = args.input_path
rotation_angle = args.rotation_angle
##############################################################
#get list of nii or nii.gz source files
source_files = os.listdir(input_path)
slice_counter = 0
#identify sample ids and get source ids
source_ids = [files[0:8] for files in source_files if files.endswith('.nii')]

sample_ids = list(set(source_ids))

how to use nii_to_png_converter.py

Hi,
First of all thanks for writing such awesome code for helping others.

Now let's come to my problem. I was trying to use your code for my research. I successfully used "nii2png.py" to convert a single 3D nifti file. But did not find the use of "nii_to_png_converter.py" anywhere in your documentation. Can you please explain how to use it? That would be of great help. Thank you.

Sincerely,
Shabbir

Shutil error while installing

I am trying to install it using admin and facing following problem !

Collecting shutil (from nii2png)
Could not find a version that satisfies the requirement shutil (from nii2png) (from versions: )
No matching distribution found for shutil (from nii2png)

scipy.misc.imsave is deprecated

According to the scipy documentation, the scipy.misc.imsave function is deprecated. More so, it has been completely removed in newer scipy 1.3+ versions, so that nii2png now fails:

$ python nii2png.py -i in.png -o foo/
Reading NIfTI file...
Saving image...
Traceback (most recent call last):
  File "nii2png.py", line 158, in <module>
    main(sys.argv[1:])
  File "nii2png.py", line 142, in main
    scipy.misc.imsave(image_name, data)
AttributeError: module 'scipy.misc' has no attribute 'imsave'

However, the documentation linked above does recommend another way to save images.

UnboundLocalError

Hi!
While trying to run from the code in latest stable zip file, I am getting this error:

Traceback (most recent call last):
  File "nii2png.py", line 159, in <module>
    main(sys.argv[1:])
  File "nii2png.py", line 42, in main
    data_4d = image_array[:, :, i, j]
UnboundLocalError: local variable 'i' referenced before assignment

What are these i and j variables for?

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.