Open salil1809 opened 5 years ago
Seems like an abandoned project. Use my tool: https://github.com/alexlaurence/NIfTI-Image-Converter
Thanks Alexlaurence for nii2png, i'm having trouble using nii2png to convert a single-slice nifti, is there a way to make it work with non-3D or 4D nii ? thank you
@kondikeyoy ---- You can convert a single slice nifti (within a 3D volume) in the following way.
med2image -i SAG-anon-nii/SAG-anon.nii \
-d nifti-results/single-slice \
-o sample --outputFileType jpg \
--sliceToConvert
PS: Please go through "Case 2: Converting a single slice" under the NIFTI files section in the README.rst for this project.
Please go through the new and updated README.rst
file and follow the instructions to run med2image
on a UNIX system.
We are now also providing a Docker container called pl-med2img
Follow this link for detailed instructions: https://github.com/FNNDSC/pl-med2img
@kondikeyoy ---- You can convert a single slice nifti (within a 3D volume) in the following way.
med2image -i SAG-anon-nii/SAG-anon.nii -d nifti-results/single-slice -o sample --outputFileType jpg --sliceToConvert
PS: Please go through "Case 2: Converting a single slice" under the NIFTI files section in the README.rst for this project.
med2image: error: argument -s/--sliceToConvert: expected one argument
@kondikeyoy ---- You can convert a single slice nifti (within a 3D volume) in the following way.
med2image -i SAG-anon-nii/SAG-anon.nii -d nifti-results/single-slice -o sample --outputFileType jpg --sliceToConvert
PS: Please go through "Case 2: Converting a single slice" under the NIFTI files section in the README.rst for this project.
What if you have just 2D nifti slices saved separatly?
@BogoK --- If you have just 2D nifti slices saved separately, you can pass one of the slices to the -inputFile
argument, and mention the slice number you want to convert to the --sliceToConvert
argument. (This is similar to how the DICOM file conversion example is shown)
Hopefully, this should work for you. Let us know if there are ay other issues.
Hello @arushivyas
I am also facing the above issue, please take a look at the stack trace.
Traceback (most recent call last):
File "/home/ubuntu/.local/bin/med2image", line 297, in <module>
imgConverter.run()
File "/home/ubuntu/.local/lib/python3.6/site-packages/med2image/med2image.py", line 668, in run
slices = self._Vnp_3DVol.shape[2]
AttributeError: 'NoneType' object has no attribute 'shape'
Arguments passed : med2image -i localfile.nii -d nifti-results/middle-slice -o sample --outputFileType jpg --sliceToConvert 1
Hey @btrx-sreddy -- kindly provide your full CLI that you used
@rudolphpienaar Please find below Full CLI med2image -i xxxxxxxxxxxxxx.dtseries.nii -d nifti-results/middle-slice -o sample --outputFileType jpg --sliceToConvert -1
Matplotlib created a temporary config/cache directory at /home/ubuntu/.config/matplotlib because the default path (/tmp/matplotlib-xvawzp66) is not a writable directory; it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing. sliceToConvert: -1 2020-07-30 14:18:26 | ip-XXXXXX | med2image.py:med2image.run() | About to perform NifTI to jpg conversion...
Traceback (most recent call last): File "/home/ubuntu/.local/bin/med2image", line 297, in
imgConverter.run() File "/home/ubuntu/.local/lib/python3.6/site-packages/med2image/med2image.py", line 668, in run slices = self._Vnp_3DVol.shape[2] AttributeError: 'NoneType' object has no attribute 'shape'
Well, I suppose the first question is do you know if your NifTI file is OK? Have you tried with other files?
I guess the question I have really is: Is the issue with med2image.py
or with your actual data? Can you think of a way to test that?
Also, feel free to add your NifTI here so we might actually be able to test.
I
@rudolphpienaar Please find below Full CLI med2image -i xxxxxxxxxxxxxx.dtseries.nii -d nifti-results/middle-slice -o sample --outputFileType jpg --sliceToConvert -1
Matplotlib created a temporary config/cache directory at /home/ubuntu/.config/matplotlib because the default path (/tmp/matplotlib-xvawzp66) is not a writable directory; it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing. sliceToConvert: -1 2020-07-30 14:18:26 | ip-XXXXXX | med2image.py:med2image.run() | About to perform NifTI to jpg conversion... Traceback (most recent call last): File "/home/ubuntu/.local/bin/med2image", line 297, in imgConverter.run() File "/home/ubuntu/.local/lib/python3.6/site-packages/med2image/med2image.py", line 668, in run slices = self._Vnp_3DVol.shape[2] AttributeError: 'NoneType' object has no attribute 'shape'
I've got the exact same issue. Attached is my dtseries.nii file https://drive.google.com/file/d/1QVWsNXyyA4yvyaX61curLwRTlB8oUwcg/view?usp=sharing
Traceback (most recent call last): File "C:\Users\Salil Gupta\Documents\med2image-master\bin\med.py", line 296, in
C_convert.run()
File "C:\Users\Salil Gupta\Documents\med2image-master\bin..\med2image\med2image.py", line 522, in run
slices = self._Vnp_3DVol.shape[2]
AttributeError: 'NoneType' object has no attribute 'shape'
This issue occurs when i try to convert a rgb nii with transparency (nii + dicom overlay) to png. if we don't add transparency, its converting into grayscale images in which we cannot see the annotations.