Skip to content

Commit

Permalink
OMERO_NUMPY_DTYPES holds types not strings
Browse files Browse the repository at this point in the history
  • Loading branch information
will-moore committed Dec 13, 2023
1 parent 9c22335 commit 359c48b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/omero/gateway/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@
logger = logging.getLogger(__name__)
THISPATH = os.path.dirname(os.path.abspath(__file__))
OMERO_NUMPY_DTYPES = {
PixelsTypeint8: 'int8',
PixelsTypeuint8: 'uint8',
PixelsTypeint16: 'int16',
PixelsTypeuint16: 'uint16',
PixelsTypeint32: 'int32',
PixelsTypeuint32: 'uint32',
PixelsTypefloat: 'float32',
PixelsTypedouble: 'double'
PixelsTypeint8: numpy.int8,
PixelsTypeuint8: numpy.uint8,
PixelsTypeint16: numpy.int16,
PixelsTypeuint16: numpy.uint16,
PixelsTypeint32: numpy.int32,
PixelsTypeuint32: numpy.uint32,
PixelsTypefloat: numpy.float32,
PixelsTypedouble: numpy.float64,
}

try:
Expand Down Expand Up @@ -3802,7 +3802,7 @@ def createImage(firstPlane, channelList):
img = self.getObject("Image", iId.getValue())
newPtype = img.getPrimaryPixels().getPixelsType().getValue()
if OMERO_NUMPY_DTYPES[newPtype] != firstPlane.dtype.name:
convertToType = numpy.dtype(OMERO_NUMPY_DTYPES[newPtype])
convertToType = OMERO_NUMPY_DTYPES[newPtype]
img._obj.setName(rstring(imageName))
img._obj.setSeries(rint(0))
updateService.saveObject(img._obj, self.SERVICE_OPTS)
Expand Down Expand Up @@ -7498,7 +7498,7 @@ def getPlane(self, theZ=0, theC=0, theT=0):

def get_numpy_pixels_type(self):
pixels_type = self.getPixelsType().value
return numpy.dtype(OMERO_NUMPY_DTYPES[pixels_type])
return OMERO_NUMPY_DTYPES[pixels_type]

def getTiles(self, zctTileList):
"""
Expand Down

0 comments on commit 359c48b

Please sign in to comment.