@@ -10,8 +10,9 @@ class RegionOfInterest(BaseNeo):
1010 _parent_objects = ('Group' ,)
1111 _parent_attrs = ('group' ,)
1212 _necessary_attrs = (
13- ('obj ' , ('ImageSequence' , ), 1 ),
13+ ('image_sequence ' , ('ImageSequence' , ), 1 ),
1414 )
15+ is_view = True
1516
1617 def __init__ (self , image_sequence , name = None , description = None , file_origin = None , ** annotations ):
1718 super ().__init__ (name = name , description = description ,
@@ -22,6 +23,17 @@ def __init__(self, image_sequence, name=None, description=None, file_origin=None
2223 raise ValueError ("Can only take a RegionOfInterest of an ImageSequence" )
2324 self .image_sequence = image_sequence
2425
26+ def _get_obj (self ):
27+ # for consistency with ChannelView
28+ return self .image_sequence
29+
30+ def _set_obj (self , value ):
31+ if not isinstance (value , ImageSequence ):
32+ raise TypeError (f"Value must be ImageSequence, not of type: { type (value )} " )
33+ self .image_sequence = value
34+
35+ obj = property (fget = _get_obj , fset = _set_obj )
36+
2537 def resolve (self ):
2638 """
2739 Return a signal from within this region of the underlying ImageSequence.
@@ -44,6 +56,13 @@ class CircularRegionOfInterest(RegionOfInterest):
4456 Radius of the ROI in pixels
4557 """
4658
59+ _necessary_attrs = (
60+ ('image_sequence' , ('ImageSequence' , ), 1 ),
61+ ('x' , int ),
62+ ('y' , int ),
63+ ('radius' , int )
64+ )
65+
4766 def __init__ (self , image_sequence , x , y , radius , name = None , description = None ,
4867 file_origin = None , ** annotations ):
4968 super ().__init__ (image_sequence , name , description , file_origin , ** annotations )
@@ -94,6 +113,14 @@ class RectangularRegionOfInterest(RegionOfInterest):
94113 Height (y-direction) of the ROI in pixels
95114 """
96115
116+ _necessary_attrs = (
117+ ('image_sequence' , ('ImageSequence' , ), 1 ),
118+ ('x' , int ),
119+ ('y' , int ),
120+ ('width' , int ),
121+ ('height' , int )
122+ )
123+
97124 def __init__ (self , image_sequence , x , y , width , height , name = None , description = None ,
98125 file_origin = None , ** annotations ):
99126 super ().__init__ (image_sequence , name , description , file_origin , ** annotations )
@@ -139,6 +166,11 @@ class PolygonRegionOfInterest(RegionOfInterest):
139166 of the vertices of the polygon
140167 """
141168
169+ _necessary_attrs = (
170+ ('image_sequence' , ('ImageSequence' , ), 1 ),
171+ ('vertices' , list ),
172+ )
173+
142174 def __init__ (self , image_sequence , * vertices , name = None , description = None ,
143175 file_origin = None , ** annotations ):
144176 super ().__init__ (image_sequence , name , description , file_origin , ** annotations )
0 commit comments