Open phrozendice opened 6 years ago
@phrozendice Would you be able to provide the file that causes this error?
@danishm thank you for your prompt response, unfortunately I can’t provide the source file as it contains personal identifiable information. If there is anything else I can do to help you reproduce please let me know.
@phrozendice That makes total sense! Yes, patient privacy is important. I've been developing on a cases by case basis using publicly available samples mostly. I have a few in this folder for testing in the project. Here is how you can help
Possible ways to help
image_2d_scaled
look like on this line of code. I'm more interested in the shape rather than the data i.e. is it in fact a 2d array with some data inside it and what's it shape is.@phrozendice Any news on this issue ? I'm running in the same problem and I'm having a hard time figuring why because this tool always worked for me with my previous DICOM files (thanks @danishm!)
@danishm Here is what I have when i print the image_2d_scaled variable:
`mritopng IVA0\ (1) output.png Arguments: %s Namespace(auto_contrast=False, dicom_path='IVA0 (1)', folder=False, png_path='output.png') Removing existing output file output.png [[[ 0. 0. 0. ] [ 0. 0. 0. ] [ 0. 0. 0. ] ... [ 0. 0. 0. ] [ 0. 0. 0. ] [ 0. 0. 0. ]]
[[ 0. 0. 0. ] [ 0. 0. 0. ] [ 0. 0. 0. ] ... [ 0. 0. 0. ] [ 0. 0. 0. ] [ 0. 0. 0. ]]
[[ 0. 0. 0. ] [ 0. 0. 0. ] [ 0. 0. 0. ] ... [ 0. 0. 0. ] [ 0. 0. 0. ] [ 0. 0. 0. ]]
...
[[ 0. 0. 0. ] [ 0. 0. 0. ] [99.23076923 99.23076923 99.23076923] ... [ 0. 0. 0. ] [ 0. 0. 0. ] [ 0. 0. 0. ]]
[[ 0. 0. 0. ] [ 0. 0. 0. ] [ 0. 0. 0. ] ... [ 0. 0. 0. ] [ 0. 0. 0. ] [ 0. 0. 0. ]]
[[ 0. 0. 0. ] [ 0. 0. 0. ] [ 0. 0. 0. ] ... [ 0. 0. 0. ] [ 0. 0. 0. ] [ 0. 0. 0. ]]] Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/png.py", line 795, in write_passes extend(row) TypeError: only size-1 arrays can be converted to Python scalars
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/bin/mritopng", line 11, in
Hi There,
Tried to convert a .dcm file to png, using the command line on Mac OS X with Python 2.7.12 here is the output:
mritopng ~/file1.dcm ~/file1.png Traceback (most recent call last): File "/usr/local/bin/mritopng", line 11, in
load_entry_point('mritopng==2.1', 'console_scripts', 'mritopng')()
File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mritopng-2.1-py2.7.egg/mritopng/main.py", line 19, in main
convert_file(args.dicom_path, args.png_path)
File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mritopng-2.1-py2.7.egg/mritopng/init.py", line 50, in convert_file
mri_to_png(mri_file, png_file)
File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mritopng-2.1-py2.7.egg/mritopng/init.py", line 28, in mri_to_png
w.write(png_file, image_2d_scaled)
File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/png.py", line 655, in write
nrows = self.write_passes(outfile, rows)
File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/png.py", line 804, in write_passes
extend(row)
File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/png.py", line 801, in
return lambda sl: f(map(int, sl))
TypeError: only size-1 arrays can be converted to Python scalars
Any ideas?