예제 #1
0
파일: tiler.py 프로젝트: carandraug/PyME
    def start(self):
        self._gen_weights()
        self.genCoords()

        #metadata handling
        self.mdh = MetaDataHandler.NestedClassMDHandler()
        self.mdh.setEntry('StartTime', time.time())
        self.mdh.setEntry('AcquisitionType', 'Tiled overview')

        #loop over all providers of metadata
        for mdgen in MetaDataHandler.provideStartMetadata:
            mdgen(self.mdh)

        self._x0 = self.xp[0]
        self._y0 = self.yp[0]

        self._pixel_size = self.mdh.getEntry('voxelsize.x')
        self.background = self.mdh.getOrDefault('Camera.ADOffset',
                                                self.background)

        # make our x0, y0 independent of the camera ROI setting
        x0_cam, y0_cam = MetaDataHandler.get_camera_physical_roi_origin(
            self.mdh)

        x0 = self._x0 + self._pixel_size * x0_cam
        y0 = self._y0 + self._pixel_size * y0_cam

        self.P = tile_pyramid.ImagePyramid(self._tiledir,
                                           self._base_tile_size,
                                           x0=x0,
                                           y0=y0,
                                           pixel_size=self._pixel_size)

        pointScanner.PointScanner.start(self)
예제 #2
0
    def start(self):
        #self._weights =tile_pyramid.ImagePyramid.frame_weights(self.scope.frameWrangler.currentFrame.shape[:2]).squeeze()

        self.genCoords()

        #metadata handling
        self.mdh = MetaDataHandler.NestedClassMDHandler()
        self.mdh.setEntry('StartTime', time.time())
        self.mdh.setEntry('AcquisitionType', 'Tiled overview')

        #loop over all providers of metadata
        for mdgen in MetaDataHandler.provideStartMetadata:
            mdgen(self.mdh)

        self._x0 = np.min(
            self.xp
        )  # get the upper left corner of the scan, regardless of shape/fill/start
        self._y0 = np.min(self.yp)

        self._pixel_size = self.mdh.getEntry('voxelsize.x')
        self.background = self.mdh.getOrDefault('Camera.ADOffset',
                                                self.background)

        # calculate origin independent of the camera ROI setting to store in
        # metadata for use in e.g. SupertileDatasource.DataSource.tile_coords_um
        x0_cam, y0_cam = MetaDataHandler.get_camera_physical_roi_origin(
            self.mdh)

        x0 = self._x0 + self._pixel_size * x0_cam  # offset in [um]
        y0 = self._y0 + self._pixel_size * y0_cam

        if self._backend == 'cluster':
            from PYME.Analysis import distributed_pyramid
            self.P = distributed_pyramid.DistributedImagePyramid(
                self._tiledir,
                self._base_tile_size,
                x0=x0,
                y0=y0,
                pixel_size=self._pixel_size)
        else:
            self.P = tile_pyramid.ImagePyramid(self._tiledir,
                                               self._base_tile_size,
                                               x0=x0,
                                               y0=y0,
                                               pixel_size=self._pixel_size)

        pointScanner.PointScanner.start(self)
예제 #3
0
 def _set_tile_source(self, tile_dir):
     self.tile_dir = tile_dir
     self.mdh = MetaDataHandler.load_json(
         os.path.join(tile_dir, 'metadata.json'))
     self._pyramid = tile_pyramid.ImagePyramid(
         tile_dir, pyramid_tile_size=self.mdh['Pyramid.TileSize'])