@@ -114,23 +114,32 @@ def mock_VolumetricImagingSpace(
114114 return volumetric_imaging_space
115115
116116
117+ def mock_SummaryImage (
118+ * ,
119+ name : Optional [str ] = None ,
120+ description : str = "A mock instance of a SummaryImage type to be used for rapid testing." ,
121+ image_shape : Tuple [int , int ] = (10 , 10 ),
122+ data : Optional [np .ndarray ] = None ,
123+ ) -> ndx_microscopy .SummaryImage :
124+ name = name or name_generator ("SummaryImage" )
125+ data = data if data is not None else np .ones (image_shape )
126+ summary_image = ndx_microscopy .SummaryImage (name = name , description = description , data = data )
127+ return summary_image
128+
129+
117130def mock_Segmentation (
118131 * ,
119132 name : Optional [str ] = None ,
120133 description : str = "A mock instance of a Segmentation type to be used for rapid testing." ,
121- summary_images : Optional [List [pynwb . base . Images ]] = None ,
134+ summary_images : Optional [List [ndx_microscopy . SummaryImage ]] = None ,
122135) -> ndx_microscopy .Segmentation :
123136 """Base abstract class with summary images."""
124137 name = name or name_generator ("Segmentation" )
125138
126139 # Create default summary images if none provided
127140 if summary_images is None :
128- mean_image = pynwb .base .Image (
129- name = "mean" , data = np .ones ((10 , 10 )), description = "Mean intensity projection" # Example shape
130- )
131- max_image = pynwb .base .Image (
132- name = "max" , data = np .ones ((10 , 10 )), description = "Maximum intensity projection" # Example shape
133- )
141+ mean_image = mock_SummaryImage (name = "mean" , description = "Mean intensity projection" )
142+ max_image = mock_SummaryImage (name = "max" , description = "Maximum intensity projection" )
134143 summary_images = [mean_image , max_image ]
135144
136145 segmentation = ndx_microscopy .Segmentation (name = name , description = description , summary_images = summary_images )
@@ -152,8 +161,8 @@ def mock_Segmentation2D(
152161
153162 # Create default summary images if none provided
154163 if summary_images is None :
155- mean_image = pynwb . base . Image (name = "mean" , data = np . ones ( image_shape ), description = "Mean intensity projection" )
156- max_image = pynwb . base . Image (name = "max" , data = np . ones ( image_shape ), description = "Maximum intensity projection" )
164+ mean_image = mock_SummaryImage (name = "mean" , description = "Mean intensity projection" , image_shape = image_shape )
165+ max_image = mock_SummaryImage (name = "max" , description = "Maximum intensity projection" , image_shape = image_shape )
157166 summary_images = [mean_image , max_image ]
158167
159168 segmentation_2D = ndx_microscopy .Segmentation2D (
@@ -188,16 +197,8 @@ def mock_Segmentation3D(
188197
189198 # Create default summary images if none provided
190199 if summary_images is None :
191- mean_image = pynwb .base .Image (
192- name = "mean" ,
193- data = np .ones ((image_shape [0 ], image_shape [1 ])), # Project along Z
194- description = "Mean intensity projection" ,
195- )
196- max_image = pynwb .base .Image (
197- name = "max" ,
198- data = np .ones ((image_shape [0 ], image_shape [1 ])), # Project along Z
199- description = "Maximum intensity projection" ,
200- )
200+ mean_image = mock_SummaryImage (name = "mean" , description = "Mean intensity projection" , image_shape = image_shape )
201+ max_image = mock_SummaryImage (name = "max" , description = "Maximum intensity projection" , image_shape = image_shape )
201202 summary_images = [mean_image , max_image ]
202203
203204 volumetric_segmentation = ndx_microscopy .Segmentation3D (
0 commit comments