#1800 closed defect (fixed)
error reading DICOM CT: TypeError: Cannot cast ufunc multiply output
Reported by: | Elaine Meng | Owned by: | Tom Goddard |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | Volume Data | Version: | |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Notify when closed: | Platform: | all | |
Project: | ChimeraX |
Description
for example, the CT subdirectory in the same dataset as attached to ticket #1662
UCSF ChimeraX version: 0.9 (2019-03-25)
© 2016-2019 Regents of the University of California. All rights reserved.
How to cite UCSF ChimeraX
open "/Users/meng/Desktop/02-20-2000-522-26564/1-CTs from rtog conversion-564.2" format dicomTraceback (most recent call last):
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/ui/gui.py", line 808, in <lambda>
open_folder_action.triggered.connect(lambda arg, s=self, sess=session: s.folder_open_cb(sess))
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/ui/gui.py", line 573, in folder_open_cb
self._open_folder.display(session)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/ui/open_folder.py", line 62, in display
run(session, cmd)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/core/commands/run.py", line 31, in run
results = command.run(text, log=log)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/core/commands/cli.py", line 2616, in run
result = ci.function(session, kw_args)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/core/commands/open.py", line 41, in open
from_database=from_database, ignore_cache=ignore_cache, kw))
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/core/commands/open.py", line 117, in open
models = handle_unknown_kw(session.models.open, paths, format=format, name=name, kw)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/core/commands/open.py", line 62, in handle_unknown_kw
return f(*args, kw)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/core/models.py", line 598, in open
session, filenames, format=format, name=name, kw)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/core/io.py", line 463, in open_multiple_data
models, status = open_func(session, paths, mname, kw)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/dicom/dicom.py", line 39, in open_dicom
models, msg = dicom_volumes(session, image_series, kw)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/dicom/dicom.py", line 117, in dicom_volumes
gmodels, gmsg = open_grids(session, grid_group, gname, kw)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/map/volume.py", line 3241, in open_grids
v.initialize_thresholds()
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/map/volume.py", line 520, in initialize_thresholds
s = self.matrix_value_statistics()
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/map/volume.py", line 1629, in matrix_value_statistics
matrices = self.displayed_matrices(read_matrix)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/map/volume.py", line 1664, in displayed_matrices
matrices.append(self.matrix(read_matrix))
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/map/volume.py", line 1179, in matrix
m = self.region_matrix(r, read_matrix)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/map/volume.py", line 1203, in region_matrix
m = d.matrix(origin, size, step, progress, from_cache_only)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/map/data/griddata.py", line 248, in matrix
m = self.read_matrix(ijk_origin, ijk_size, ijk_step, progress)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/map/data/griddata.py", line 267, in read_matrix
m = self._read_full_planes(ijk_origin, ijk_size, ijk_step, progress)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/map/data/griddata.py", line 296, in _read_full_planes
m2d= self.read_xy_plane(k)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/dicom/dicom_grid.py", line 118, in read_xy_plane
m = self.dicom_data.read_plane(k, self.time, c)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/dicom/dicom_format.py", line 546, in read_plane
data *= self.rescale_slope
TypeError: Cannot cast ufunc multiply output from dtype('float64') to dtype('uint16') with casting rule 'same_kind'
TypeError: Cannot cast ufunc multiply output from dtype('float64') to dtype('uint16') with casting rule 'same_kind'
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/dicom/dicom_format.py", line 546, in read_plane
data *= self.rescale_slope
See log for complete Python traceback.
Traceback (most recent call last):
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/core/triggerset.py", line 130, in invoke
return self._func(self._name, data)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/map/volume.py", line 3489, in _update_drawings
v.initialize_thresholds()
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/map/volume.py", line 520, in initialize_thresholds
s = self.matrix_value_statistics()
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/map/volume.py", line 1629, in matrix_value_statistics
matrices = self.displayed_matrices(read_matrix)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/map/volume.py", line 1664, in displayed_matrices
matrices.append(self.matrix(read_matrix))
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/map/volume.py", line 1179, in matrix
m = self.region_matrix(r, read_matrix)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/map/volume.py", line 1203, in region_matrix
m = d.matrix(origin, size, step, progress, from_cache_only)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/map/data/griddata.py", line 248, in matrix
m = self.read_matrix(ijk_origin, ijk_size, ijk_step, progress)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/map/data/griddata.py", line 267, in read_matrix
m = self._read_full_planes(ijk_origin, ijk_size, ijk_step, progress)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/map/data/griddata.py", line 296, in _read_full_planes
m2d= self.read_xy_plane(k)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/dicom/dicom_grid.py", line 118, in read_xy_plane
m = self.dicom_data.read_plane(k, self.time, c)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/dicom/dicom_format.py", line 546, in read_plane
data *= self.rescale_slope
TypeError: Cannot cast ufunc multiply output from dtype('float64') to dtype('uint16') with casting rule 'same_kind'
Error processing trigger "graphics update": Cannot cast ufunc multiply output from dtype('float64') to dtype('uint16') with casting rule 'same_kind':
TypeError: Cannot cast ufunc multiply output from dtype('float64') to dtype('uint16') with casting rule 'same_kind'
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chimerax/dicom/dicom_format.py", line 546, in read_plane
data *= self.rescale_slope
See log for complete Python traceback.
Change History (5)
comment:1 by , 7 years ago
Summary: | error reading DICOM CT → error reading DICOM CT: TypeError: Cannot cast ufunc multiply output |
---|
comment:2 by , 7 years ago
comment:3 by , 7 years ago
I get a similar error except for "ufunc add" instead of "ufunc multiply" trying to open the near-isotropic CT dataset mentioned on our examples page <http://www.rbvi.ucsf.edu/chimerax/dicom/examples.html>:
TypeError: Cannot cast ufunc add output from dtype('int32') to dtype('uint16') with casting rule 'same_kind'
comment:4 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fixed.
Problem was with floating point dicom scaling factor applied to integer value data in new plane reading code. Only tested first dataset mentioned since UCSF internet connectivity broken today.
comment:5 by , 7 years ago
I tested the datasets in the additional comments, and they all open without ufunc errors. Looks good, thanks!
I also get this error with the mouse brain MR, including the time series, but not the prostate time series on the 3DSlicer website (both mentioned on our examples page
http://www.rbvi.ucsf.edu/chimerax/dicom/examples.html )