Пример #1
0
def CreatePlaneSegmentation():
    w, h = 5, 5
    img_mask = [[[1.0 for x in range(w)] for y in range(h)],
                [[2.0 for x in range(w)] for y in range(h)]]
    pix_mask = [[1, 2, 1.0], [3, 4, 1.0], [5, 6, 1.0], [7, 8, 2.0],
                [9, 10, 2.0]]

    iSS = ImageSeries(name='test_iS',
                      data=np.ones((2, 2, 2)),
                      unit='unit',
                      external_file=['external_file'],
                      starting_frame=[1, 2, 3],
                      format='tiff',
                      timestamps=[1., 2.])

    oc = OpticalChannel('test_optical_channel', 'description', 500.)
    device = Device(name='device_name')
    ip = ImagingPlane('test_imaging_plane', oc, 'description', device, 600.,
                      300., 'indicator', 'location', (1, 2, 1, 2, 3), 4.0,
                      'unit', 'reference_frame')

    pS = PlaneSegmentation('description', ip, 'test_name', iSS)
    pS.add_roi(pixel_mask=pix_mask[0:3], image_mask=img_mask[0])
    pS.add_roi(pixel_mask=pix_mask[3:5], image_mask=img_mask[1])
    return pS
Пример #2
0
 def setUpContainer(self):
     self.device = Device(name='dev1')
     self.optical_channel = OpticalChannel('optchan1',
                                           'a fake OpticalChannel', 500.)
     return ImagingPlane('imgpln1', self.optical_channel,
                         'a fake ImagingPlane', self.device, 600., 300.,
                         'GFP', 'somewhere in the brain')
Пример #3
0
    def buildPlaneSegmentation(self):
        w, h = 5, 5
        img_mask = [[[1.0 for x in range(w)] for y in range(h)],
                    [[2.0 for x in range(w)] for y in range(h)]]
        pix_mask = [(1, 2, 1.0), (3, 4, 1.0), (5, 6, 1.0), (7, 8, 2.0),
                    (9, 10, 2.)]

        ts = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]
        self.image_series = ImageSeries(name='test_iS',
                                        source='a hypothetical source',
                                        dimension=[2],
                                        external_file=['images.tiff'],
                                        starting_frame=[1, 2, 3],
                                        format='tiff',
                                        timestamps=ts)

        self.optical_channel = OpticalChannel('test_optical_channel',
                                              'optical channel source',
                                              'optical channel description',
                                              500.)
        self.imaging_plane = ImagingPlane(
            'test_imaging_plane', 'ophys integration tests',
            self.optical_channel, 'imaging plane description',
            'imaging_device_1', 600., '2.718', 'GFP', 'somewhere in the brain',
            (1, 2, 1, 2, 3), 4.0, 'manifold unit', 'A frame to refer to')

        self.img_mask = deepcopy(img_mask)
        self.pix_mask = deepcopy(pix_mask)
        pS = PlaneSegmentation('integration test PlaneSegmentation',
                               'plane segmentation description',
                               self.imaging_plane, 'test_plane_seg_name',
                               self.image_series)
        pS.add_roi('1234', pix_mask[0:3], img_mask[0])
        pS.add_roi('5678', pix_mask[3:5], img_mask[1])
        return pS
Пример #4
0
def CreatePlaneSegmentation():
    w, h = 5, 5
    img_mask = [[[1.0 for x in range(w)] for y in range(h)],
                [[2.0 for x in range(w)] for y in range(h)]]
    pix_mask = [[1, 2, 1.0], [3, 4, 1.0], [5, 6, 1.0], [7, 8, 2.0],
                [9, 10, 2.0]]

    iSS = ImageSeries(name='test_iS',
                      source='a hypothetical source',
                      data=list(),
                      unit='unit',
                      external_file=['external_file'],
                      starting_frame=[1, 2, 3],
                      format='tiff',
                      timestamps=list())

    oc = OpticalChannel('test_optical_channel', 'test_source', 'description',
                        'emission_lambda')
    ip = ImagingPlane('test_imaging_plane', 'test_source', oc, 'description',
                      'device', 'excitation_lambda', 'imaging_rate',
                      'indicator', 'location', (1, 2, 1, 2, 3), 4.0, 'unit',
                      'reference_frame')

    pS = PlaneSegmentation('test source', 'description', ip, 'test_name', iSS)
    pS.add_roi(pix_mask[0:3], img_mask[0])
    pS.add_roi(pix_mask[3:5], img_mask[1])
    return pS
Пример #5
0
 def buildPlaneSegmentationNoRois(self):
     """ Return an PlaneSegmentation and set related objects """
     ts = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]
     self.image_series = ImageSeries(name='test_iS',
                                     dimension=[2],
                                     external_file=['images.tiff'],
                                     starting_frame=[1, 2, 3],
                                     format='tiff',
                                     timestamps=ts)
     self.device = Device(name='dev1')
     self.optical_channel = OpticalChannel(
         name='test_optical_channel',
         description='optical channel description',
         emission_lambda=500.)
     self.imaging_plane = ImagingPlane(
         name='test_imaging_plane',
         optical_channel=self.optical_channel,
         description='imaging plane description',
         device=self.device,
         excitation_lambda=600.,
         imaging_rate=300.,
         indicator='GFP',
         location='somewhere in the brain',
         reference_frame='a frame to refer to')
     return PlaneSegmentation(description='description',
                              imaging_plane=self.imaging_plane,
                              name='test_plane_seg_name',
                              reference_images=self.image_series)
Пример #6
0
def CreatePlaneSegmentation():
    w, h = 5, 5
    img_mask = [[0 for x in range(w)] for y in range(h)]
    w, h = 5, 2
    pix_mask = [[0 for x in range(w)] for y in range(h)]
    pix_mask_weight = [0 for x in range(w)]
    iSS = ImageSeries(name='test_iS',
                      source='a hypothetical source',
                      data=list(),
                      unit='unit',
                      external_file=['external_file'],
                      starting_frame=[1, 2, 3],
                      format='tiff',
                      timestamps=list())

    roi1 = ROI('roi1', 'test source', 'roi description1', pix_mask,
               pix_mask_weight, img_mask, iSS)
    roi2 = ROI('roi2', 'test source', 'roi description2', pix_mask,
               pix_mask_weight, img_mask, iSS)
    roi_list = (roi1, roi2)

    oc = OpticalChannel('test_optical_channel', 'test_source', 'description',
                        'emission_lambda')
    ip = ImagingPlane('test_imaging_plane', 'test_source', oc, 'description',
                      'device', 'excitation_lambda', 'imaging_rate',
                      'indicator', 'location', (1, 2, 1, 2, 3), 4.0, 'unit',
                      'reference_frame')

    ps = PlaneSegmentation('name', 'test source', 'description', roi_list, ip,
                           iSS)
    return ps
Пример #7
0
    def test_init(self):
        w, h = 5, 5
        img_mask = [[[1.0 for x in range(w)] for y in range(h)],
                    [[2.0 for x in range(w)] for y in range(h)]]
        pix_mask = [[1, 2, 1.0], [3, 4, 1.0], [5, 6, 1.0], [7, 8, 2.0],
                    [9, 10, 2.0]]

        iSS = ImageSeries(name='test_iS',
                          source='a hypothetical source',
                          data=list(),
                          unit='unit',
                          external_file=['external_file'],
                          starting_frame=[1, 2, 3],
                          format='tiff',
                          timestamps=list())

        oc = OpticalChannel('test_optical_channel', 'test_source',
                            'description', 500.)
        ip = ImagingPlane('test_imaging_plane', 'test_source', oc,
                          'description', 'device', 600., 'imaging_rate',
                          'indicator', 'location', (1, 2, 1, 2, 3), 4.0,
                          'unit', 'reference_frame')

        pS = PlaneSegmentation('test source', 'description', ip, 'test_name',
                               iSS)
        pS.add_roi("1234", pix_mask[0:3], img_mask[0])
        pS.add_roi("5678", pix_mask[3:5], img_mask[1])

        self.assertEqual(pS.description, 'description')
        self.assertEqual(pS.source, 'test source')

        self.assertEqual(pS.imaging_plane, ip)
        self.assertEqual(pS.reference_images, iSS)
        self.assertEqual(pS.pixel_masks.data, pix_mask)
        self.assertEqual(pS.image_masks.data, img_mask)
Пример #8
0
    def test_init(self):
        oc = OpticalChannel('test_name', 'description', 500.)
        self.assertEqual(oc.description, 'description')
        self.assertEqual(oc.emission_lambda, 500.)

        device = Device(name='device_name')
        ip = ImagingPlane('test_imaging_plane', oc, 'description', device, 600.,
                          300., 'indicator', 'location', (50, 100, 3), 4.0, 'unit', 'reference_frame')
        self.assertEqual(ip.optical_channel[0], oc)
        self.assertEqual(ip.device, device)
        self.assertEqual(ip.excitation_lambda, 600.)
        self.assertEqual(ip.imaging_rate, 300.)
        self.assertEqual(ip.indicator, 'indicator')
        self.assertEqual(ip.location, 'location')
        self.assertEqual(ip.manifold, (50, 100, 3))
        self.assertEqual(ip.conversion, 4.0)
        self.assertEqual(ip.unit, 'unit')
        self.assertEqual(ip.reference_frame, 'reference_frame')

        tPS = TwoPhotonSeries('test_tPS', unit='unit', field_of_view=[2., 3.],
                              imaging_plane=ip, pmt_gain=1.0, scan_line_rate=2.0, external_file=['external_file'],
                              starting_frame=[1, 2, 3], format='tiff', timestamps=list())
        self.assertEqual(tPS.name, 'test_tPS')
        self.assertEqual(tPS.unit, 'unit')
        self.assertEqual(tPS.field_of_view, [2., 3.])
        self.assertEqual(tPS.imaging_plane, ip)
        self.assertEqual(tPS.pmt_gain, 1.0)
        self.assertEqual(tPS.scan_line_rate, 2.0)
        self.assertEqual(tPS.external_file, ['external_file'])
        self.assertEqual(tPS.starting_frame, [1, 2, 3])
        self.assertEqual(tPS.format, 'tiff')
        self.assertIsNone(tPS.dimension)
Пример #9
0
    def test_init(self):
        oc, device = self.set_up_dependencies()

        ip = ImagingPlane(name='test_imaging_plane',
                          optical_channel=oc,
                          description='description',
                          device=device,
                          excitation_lambda=600.,
                          imaging_rate=300.,
                          indicator='indicator',
                          location='location',
                          reference_frame='reference_frame',
                          origin_coords=[10, 20],
                          origin_coords_unit='oc_unit',
                          grid_spacing=[1, 2, 3],
                          grid_spacing_unit='gs_unit')
        self.assertEqual(ip.optical_channel[0], oc)
        self.assertEqual(ip.device, device)
        self.assertEqual(ip.excitation_lambda, 600.)
        self.assertEqual(ip.imaging_rate, 300.)
        self.assertEqual(ip.indicator, 'indicator')
        self.assertEqual(ip.location, 'location')
        self.assertEqual(ip.reference_frame, 'reference_frame')
        self.assertEqual(ip.origin_coords, [10, 20])
        self.assertEqual(ip.origin_coords_unit, 'oc_unit')
        self.assertEqual(ip.grid_spacing, [1, 2, 3])
        self.assertEqual(ip.grid_spacing_unit, 'gs_unit')
Пример #10
0
 def make_imaging_plane(self, source):
     self.optical_channel = OpticalChannel('optchan1', source,
                                           'a fake OpticalChannel', 500.)
     self.imaging_plane = ImagingPlane('imgpln1', source,
                                       self.optical_channel,
                                       'a fake ImagingPlane',
                                       'imaging_device_1', 600., '2.718',
                                       'GFP', 'somewhere in the brain')
Пример #11
0
 def make_imaging_plane(self):
     self.device = Device(name='dev1')
     self.optical_channel = OpticalChannel('optchan1',
                                           'a fake OpticalChannel', 500.)
     self.imaging_plane = ImagingPlane('imgpln1', self.optical_channel,
                                       'a fake ImagingPlane', self.device,
                                       600., 300., 'GFP',
                                       'somewhere in the brain')
Пример #12
0
 def addContainer(self, file):
     oc = OpticalChannel('optchan1', 'unit test TestImagingPlaneIO',
                         'a fake OpticalChannel', '3.14')
     ip = ImagingPlane('imgpln1', 'unit test TestImagingPlaneIO', oc,
                       'a fake ImagingPlane', 'imaging_device_1', '6.28',
                       '2.718', 'GFP', 'somewhere in the brain')
     file.set_imaging_plane(ip)
     return ip
Пример #13
0
 def setUpContainer(self):
     self.optical_channel = OpticalChannel('optchan1',
                                           'unit test TestImagingPlaneIO',
                                           'a fake OpticalChannel', 500.)
     return ImagingPlane('imgpln1', 'unit test TestImagingPlaneIO',
                         self.optical_channel, 'a fake ImagingPlane',
                         'imaging_device_1', 600., '2.718', 'GFP',
                         'somewhere in the brain')
Пример #14
0
 def test_args(self):
     oc = OpticalChannel('test_name', 'description', 500.)
     device = Device(name='device_name')
     ip = ImagingPlane('test_imaging_plane', oc, 'description', device, 600.,
                       300., 'indicator', 'location', (50, 100, 3), 4.0, 'unit', 'reference_frame')
     with self.assertRaises(ValueError):  # no data or external file
         TwoPhotonSeries('test_tPS', unit='unit', field_of_view=[2., 3.],
                         imaging_plane=ip, pmt_gain=1.0, scan_line_rate=2.0,
                         starting_frame=[1, 2, 3], format='tiff', timestamps=[1., 2.])
Пример #15
0
    def getBoilerPlateObjects(self):

        iSS = ImageSeries(name='test_iS', data=np.ones((2, 2, 2)), unit='unit',
                          external_file=['external_file'], starting_frame=[1, 2, 3], format='tiff', timestamps=list())

        device = Device(name='device_name')
        oc = OpticalChannel('test_optical_channel', 'description', 500.)
        ip = ImagingPlane('test_imaging_plane', oc, 'description', device, 600.,
                          300., 'indicator', 'location', (1, 2, 1, 2, 3), 4.0, 'unit', 'reference_frame')
        return iSS, ip
Пример #16
0
    def test_conversion_deprecated(self):
        oc = OpticalChannel('test_name', 'description', 500.)
        self.assertEqual(oc.description, 'description')
        self.assertEqual(oc.emission_lambda, 500.)

        device = Device(name='device_name')

        msg = "The 'conversion' argument is deprecated in favor of 'origin_coords' and 'grid_spacing'."
        with self.assertWarnsWith(DeprecationWarning, msg):
            ImagingPlane('test_imaging_plane', oc, 'description', device, 600., 300., 'indicator', 'location',
                         None, 2.0)
Пример #17
0
 def make_imaging_plane(self):
     """ Make an ImagingPlane and related objects """
     self.device = Device(name='dev1')
     self.optical_channel = OpticalChannel('optchan1',
                                           'a fake OpticalChannel', 500.)
     self.imaging_plane = ImagingPlane('imgpln1',
                                       self.optical_channel,
                                       'a fake ImagingPlane',
                                       self.device,
                                       600.,
                                       300.,
                                       'GFP',
                                       'somewhere in the brain',
                                       reference_frame='unknown')
Пример #18
0
 def setUpContainer(self):
     """ Return the test ImagingPlane to read/write """
     self.device = Device(name='dev1')
     self.optical_channel = OpticalChannel('optchan1',
                                           'a fake OpticalChannel', 500.)
     return ImagingPlane('imgpln1',
                         self.optical_channel,
                         'a fake ImagingPlane',
                         self.device,
                         600.,
                         300.,
                         'GFP',
                         'somewhere in the brain',
                         reference_frame='unknonwn')
Пример #19
0
    def test_conversion_deprecated(self):
        oc, device = self.set_up_dependencies()

        msg = "The 'conversion' argument is deprecated in favor of 'origin_coords' and 'grid_spacing'."
        with self.assertWarnsWith(DeprecationWarning, msg):
            ImagingPlane(name='test_imaging_plane',
                         optical_channel=oc,
                         description='description',
                         device=device,
                         excitation_lambda=600.,
                         imaging_rate=300.,
                         indicator='indicator',
                         location='location',
                         conversion=2.0)
Пример #20
0
 def make_imaging_plane(self):
     """ Make an ImagingPlane and related objects """
     self.device = Device(name='dev1')
     self.optical_channel = OpticalChannel(
         name='optchan1',
         description='a fake OpticalChannel',
         emission_lambda=500.)
     self.imaging_plane = ImagingPlane(name='imgpln1',
                                       optical_channel=self.optical_channel,
                                       description='a fake ImagingPlane',
                                       device=self.device,
                                       excitation_lambda=600.,
                                       imaging_rate=300.,
                                       indicator='GFP',
                                       location='somewhere in the brain',
                                       reference_frame='unknown')
Пример #21
0
 def setBoilerPlateObjects(self):
     ts = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]
     self.image_series = ImageSeries(name='test_iS', dimension=[2],
                                     external_file=['images.tiff'],
                                     starting_frame=[1, 2, 3], format='tiff', timestamps=ts)
     self.device = Device(name='dev1')
     self.optical_channel = OpticalChannel('test_optical_channel',
                                           'optical channel description', 500.)
     self.imaging_plane = ImagingPlane('test_imaging_plane',
                                       self.optical_channel,
                                       'imaging plane description',
                                       self.device,
                                       600., 300., 'GFP', 'somewhere in the brain',
                                       (1, 2, 1, 2, 3), 4.0, 'manifold unit', 'A frame to refer to')
     return PlaneSegmentation('description', self.imaging_plane, 'test_plane_seg_name',
                              self.image_series)
Пример #22
0
    def test_init(self):
        oc = OpticalChannel('test_name', 'test_source', 'description',
                            'emission_lambda')
        self.assertEqual(oc.description, 'description')
        self.assertEqual(oc.emission_lambda, 'emission_lambda')

        ip = ImagingPlane('test_imaging_plane', 'test source', oc,
                          'description', 'device', 'excitation_lambda',
                          'imaging_rate', 'indicator', 'location',
                          (1, 2, 1, 2, 3), 4.0, 'unit', 'reference_frame')
        self.assertEqual(ip.optical_channel[0], oc)
        self.assertEqual(ip.device, 'device')
        self.assertEqual(ip.excitation_lambda, 'excitation_lambda')
        self.assertEqual(ip.imaging_rate, 'imaging_rate')
        self.assertEqual(ip.indicator, 'indicator')
        self.assertEqual(ip.location, 'location')
        self.assertEqual(ip.manifold, (1, 2, 1, 2, 3))
        self.assertEqual(ip.conversion, 4.0)
        self.assertEqual(ip.unit, 'unit')
        self.assertEqual(ip.reference_frame, 'reference_frame')

        tPS = TwoPhotonSeries('test_tPS',
                              'a hypothetical source',
                              data=list(),
                              unit='unit',
                              field_of_view=list(),
                              imaging_plane=ip,
                              pmt_gain=1.0,
                              scan_line_rate=2.0,
                              external_file=['external_file'],
                              starting_frame=[1, 2, 3],
                              format='tiff',
                              timestamps=list())
        self.assertEqual(tPS.name, 'test_tPS')
        self.assertEqual(tPS.source, 'a hypothetical source')
        self.assertEqual(tPS.unit, 'unit')
        self.assertEqual(tPS.field_of_view, list())
        self.assertEqual(tPS.imaging_plane, ip)
        self.assertEqual(tPS.pmt_gain, 1.0)
        self.assertEqual(tPS.scan_line_rate, 2.0)
        self.assertEqual(tPS.external_file, ['external_file'])
        self.assertEqual(tPS.starting_frame, [1, 2, 3])
        self.assertEqual(tPS.format, 'tiff')
        self.assertEqual(tPS.dimension, [np.nan])
Пример #23
0
    def buildPlaneSegmentation(self):
        """ Return an PlaneSegmentation and set related objects """
        w, h = 5, 5
        img_mask = [[[1.0 for x in range(w)] for y in range(h)],
                    [[2.0 for x in range(w)] for y in range(h)]]
        pix_mask = [(1, 2, 1.0), (3, 4, 1.0), (5, 6, 1.0), (7, 8, 2.0),
                    (9, 10, 2.)]

        ts = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]
        self.image_series = ImageSeries(name='test_iS',
                                        dimension=[2],
                                        external_file=['images.tiff'],
                                        starting_frame=[1, 2, 3],
                                        format='tiff',
                                        timestamps=ts)

        self.device = Device(name='dev1')
        self.optical_channel = OpticalChannel('test_optical_channel',
                                              'optical channel description',
                                              500.)
        self.imaging_plane = ImagingPlane('imgpln1',
                                          self.optical_channel,
                                          'a fake ImagingPlane',
                                          self.device,
                                          600.,
                                          200.,
                                          'GFP',
                                          'somewhere in the brain',
                                          (((1., 2., 3.), (4., 5., 6.)), ),
                                          2.,
                                          'a unit',
                                          reference_frame='unknown')

        self.img_mask = deepcopy(img_mask)
        self.pix_mask = deepcopy(pix_mask)
        self.pxmsk_index = [3, 5]
        pS = PlaneSegmentation('plane segmentation description',
                               self.imaging_plane, 'test_plane_seg_name',
                               self.image_series)
        pS.add_roi(pixel_mask=pix_mask[0:3], image_mask=img_mask[0])
        pS.add_roi(pixel_mask=pix_mask[3:5], image_mask=img_mask[1])
        return pS
Пример #24
0
def create_imaging_plane():
    oc = OpticalChannel(name='test_optical_channel',
                        description='description',
                        emission_lambda=500.)

    device = Device(name='device_name')

    ip = ImagingPlane(name='test_imaging_plane',
                      optical_channel=oc,
                      description='description',
                      device=device,
                      excitation_lambda=600.,
                      imaging_rate=300.,
                      indicator='indicator',
                      location='location',
                      reference_frame='reference_frame',
                      origin_coords=[10, 20],
                      origin_coords_unit='oc_unit',
                      grid_spacing=[1, 2, 3],
                      grid_spacing_unit='gs_unit')
    return ip
Пример #25
0
 def setUpContainer(self):
     """ Return the test ImagingPlane to read/write """
     self.device = Device(name='dev1')
     self.optical_channel = OpticalChannel(
         name='optchan1',
         description='a fake OpticalChannel',
         emission_lambda=500.)
     return ImagingPlane(
         name='imgpln1',
         optical_channel=self.optical_channel,
         description='a fake ImagingPlane',
         device=self.device,
         excitation_lambda=600.,
         imaging_rate=300.,
         indicator='GFP',
         location='somewhere in the brain',
         reference_frame='unknown',
         origin_coords=[10., 20.],
         origin_coords_unit='millimeters',
         grid_spacing=[0.001, 0.001],
         grid_spacing_unit='millimeters',
     )
Пример #26
0
 def addContainer(self, file):
     oc = OpticalChannel('optchan1', 'unit test TestImagingPlaneIO',
                         'a fake OpticalChannel', '3.14')
     ip = ImagingPlane('imgpln1', 'unit test TestImagingPlaneIO', oc,
                       'a fake ImagingPlane', 'imaging_device_1', '6.28',
                       '2.718', 'GFP', 'somewhere in the brain')
     file.set_imaging_plane(ip)
     data = list(zip(range(10), range(10, 20)))
     timestamps = list(range(10))
     fov = [2.0, 2.0, 5.0]
     tps = TwoPhotonSeries('test_2ps',
                           'unit test TestTwoPhotonSeries',
                           data,
                           ip,
                           'image_unit',
                           'raw',
                           fov,
                           1.7,
                           3.4,
                           timestamps=timestamps,
                           dimension=[2])
     file.add_acquisition(tps)
Пример #27
0
    def setUpClass(self):
        device = Device("imaging_device_1")
        optical_channel = OpticalChannel("my_optchan", "description", 500.0)
        self.imaging_plane = ImagingPlane(
            name="imgpln1",
            optical_channel=optical_channel,
            description="a fake ImagingPlane",
            device=device,
            excitation_lambda=600.0,
            imaging_rate=300.0,
            indicator="GFP",
            location="somewhere in the brain",
            reference_frame="unknown",
            origin_coords=[10, 20],
            origin_coords_unit="millimeters",
            grid_spacing=[0.001, 0.001],
            grid_spacing_unit="millimeters",
        )

        self.image_series = TwoPhotonSeries(
            name="test_image_series",
            data=np.random.randn(100, 5, 5),
            imaging_plane=self.imaging_plane,
            starting_frame=[0],
            rate=1.0,
            unit="n.a",
        )
        self.img_seg = ImageSegmentation()
        self.ps2 = self.img_seg.create_plane_segmentation(
            "output from segmenting my favorite imaging plane",
            self.imaging_plane,
            "2d_plane_seg",
            self.image_series,
        )
        self.ps2.add_column("type", "desc")
        self.ps2.add_column("type2", "desc")

        w, h = 3, 3
        img_mask1 = np.zeros((w, h))
        img_mask1[0, 0] = 1.1
        img_mask1[1, 1] = 1.2
        img_mask1[2, 2] = 1.3
        self.ps2.add_roi(image_mask=img_mask1, type=1, type2=0)

        img_mask2 = np.zeros((w, h))
        img_mask2[0, 0] = 2.1
        img_mask2[1, 1] = 2.2
        self.ps2.add_roi(image_mask=img_mask2, type=1, type2=1)

        img_mask2 = np.zeros((w, h))
        img_mask2[0, 0] = 9.1
        img_mask2[1, 1] = 10.2
        self.ps2.add_roi(image_mask=img_mask2, type=2, type2=0)

        img_mask2 = np.zeros((w, h))
        img_mask2[0, 0] = 3.5
        img_mask2[1, 1] = 5.6
        self.ps2.add_roi(image_mask=img_mask2, type=2, type2=1)

        fl = Fluorescence()
        rt_region = self.ps2.create_roi_table_region("the first of two ROIs",
                                                     region=[0, 1, 2, 3])

        rois_shape = 5
        data = np.arange(10 * rois_shape).reshape([10, -1], order='F')
        timestamps = np.array(
            [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9])
        rrs = fl.create_roi_response_series(name="my_rrs",
                                            data=data,
                                            rois=rt_region,
                                            unit="lumens",
                                            timestamps=timestamps)
        self.df_over_f = DfOverF(rrs)