jayunruh / napari_jroitools

Napari plugins for reading and writing ImageJ roi files and creating image profiles.
Other
4 stars 2 forks source link

'ROTATED_RECT' is not defined #3

Open sarahwaity opened 2 months ago

sarahwaity commented 2 months ago

Hello! I am uploading an roiset that has a type of self.freehand and the decoder.readzip is throwing a name error that 'ROTATED_RECT'. I believe that this is supposed to be 'self.ROTATED_RECT' and would otherwise not throw an error for my freehand ROIs!

{ "name": "NameError", "message": "name 'ROTATED_RECT' is not defined", "stack": "--------------------------------------------------------------------------- NameError Traceback (most recent call last) Cell In[331], line 10 5 import numpy as np 8 decoder=ir.RoiDecoder() ---> 10 rois=decoder.readzip('Analysis/RoiSet01.zip') 12 print(rois)

File ~/anaconda3/lib/python3.11/site-packages/importroi.py:87, in RoiDecoder.readzip(self, path) 85 barr=fp.read() 86 barr=np.array(bytearray(barr)) ---> 87 rois.append(self.readroibytes(barr,fname)) 88 return rois

File ~/anaconda3/lib/python3.11/site-packages/importroi.py:214, in RoiDecoder.readroibytes(self, barr, name) 212 elif(type1==self.freehand): 213 print('freehand type') --> 214 if(subtype==self.ELLIPSE or subtype==ROTATED_RECT): 215 #these are special data types 216 #need to implement these but maybe later 217 None 218 else:

NameError: name 'ROTATED_RECT' is not defined" }

jayunruh commented 2 months ago

I haven't kept up with the ImageJ Roi data types. That code is complex (see https://github.com/imagej/ImageJ/blob/master/ij/io/RoiEncoder.java) and I'm not surprised that some Roi types aren't supported. I'm happy to make updates if you have python code for these Roi types. If not, I would recommend converting them to polygon data types in ImageJ before exporting and importing in Napari.