Beispiel #1
0
    def rotate_all_relative(self, chviewer, chinfo):
        if self.ref_image is None:
            return

        # get native scale relative to reference image
        image = chviewer.get_image()
        if self.ref_image is None:
            return
        ort = wcs.get_relative_orientation(image, self.ref_image)
        self.logger.info("rotation for channel '%s' relative to ref image %f" %
                         (chinfo.name, ort.rrot_deg))

        rot_deg = chviewer.get_rotation()

        chg_rot_deg = rot_deg + ort.rrot_deg
        self.logger.info("rotation changed for channel '%s' by %f" %
                         (chinfo.name, chg_rot_deg))

        # for all other channels except ours
        chnames = self.get_other_channels(chinfo.name)
        for chname in chnames:
            chinfo2 = self.fv.get_channel(chname)

            # Get relative rotation of their image
            image = chinfo2.fitsimage.get_image()
            if image is None:
                continue
            ort = wcs.get_relative_orientation(image, self.ref_image)

            # Apply that rotation
            new_rot_deg = ort.rrot_deg + chg_rot_deg
            self.logger.info("changing rot for channel '%s' to %f" %
                             (chinfo2.name, new_rot_deg))
            chinfo2.fitsimage.rotate(new_rot_deg)
Beispiel #2
0
    def scale_all_relative(self, chviewer, chinfo):
        if self.ref_image is None:
            return

        # get native scale relative to reference image
        image = chviewer.get_image()
        ort = wcs.get_relative_orientation(image, self.ref_image)
        self.logger.info("scale for channel '%s' relative to ref image %f,%f" %
                         (chinfo.name, ort.rscale_x, ort.rscale_y))

        scale_x, scale_y = chviewer.get_scale_xy()
        #scale_x, scale_y = value

        chg_x, chg_y = scale_x / ort.rscale_x, scale_y / ort.rscale_y
        self.logger.info("scale changed for channel '%s' by %f,%f" %
                         (chinfo.name, chg_x, chg_y))

        # for all other channels except ours
        chnames = self.get_other_channels(chinfo.name)
        for chname in chnames:
            chinfo2 = self.fv.get_channel(chname)

            # calculate scale from orientation to reference image
            image = chinfo2.fitsimage.get_image()
            if image is None:
                continue
            ort = wcs.get_relative_orientation(image, self.ref_image)

            new_scale_x, new_scale_y = (ort.rscale_x * chg_x,
                                        ort.rscale_y * chg_y)
            # apply that scale
            self.logger.info("changing scale for channel '%s' to %f,%f" %
                             (chinfo2.name, new_scale_x, new_scale_y))
            chinfo2.fitsimage.scale_to(new_scale_x, new_scale_y)
Beispiel #3
0
    def rotate_all_relative(self, fitsimage, chinfo):
        if self.ref_image is None:
            return

        # get native scale relative to reference image
        image = fitsimage.get_image()
        if self.ref_image is None:
            return
        ort = wcs.get_relative_orientation(image, self.ref_image)
        self.logger.info("rotation for channel '%s' relative to ref image %f" % (
            chinfo.name, ort.rrot_deg))

        rot_deg = fitsimage.get_rotation()

        chg_rot_deg = rot_deg + ort.rrot_deg
        self.logger.info("rotation changed for channel '%s' by %f" % (
            chinfo.name, chg_rot_deg))

        # for all other channels except ours
        chnames = self.get_other_channels(chinfo.name)
        for chname in chnames:
            chinfo2 = self.fv.get_channelInfo(chname)

            # Get relative rotation of their image
            image = chinfo2.fitsimage.get_image()
            if image is None:
                continue
            ort = wcs.get_relative_orientation(image, self.ref_image)

            # Apply that rotation
            new_rot_deg = ort.rrot_deg + chg_rot_deg
            self.logger.info("changing rot for channel '%s' to %f" % (
                chinfo2.name, new_rot_deg))
            chinfo2.fitsimage.rotate(new_rot_deg)
Beispiel #4
0
    def scale_all_relative(self, fitsimage, chinfo):
        if self.ref_image is None:
            return

        # get native scale relative to reference image
        image = fitsimage.get_image()
        ort = wcs.get_relative_orientation(image, self.ref_image)
        self.logger.info("scale for channel '%s' relative to ref image %f,%f" % (
            chinfo.name, ort.rscale_x, ort.rscale_y))

        scale_x, scale_y = fitsimage.get_scale_xy()
        #scale_x, scale_y = value

        chg_x, chg_y = scale_x / ort.rscale_x, scale_y / ort.rscale_y
        self.logger.info("scale changed for channel '%s' by %f,%f" % (
            chinfo.name, chg_x, chg_y))

        # for all other channels except ours
        chnames = self.get_other_channels(chinfo.name)
        for chname in chnames:
            chinfo2 = self.fv.get_channelInfo(chname)

            # calculate scale from orientation to reference image
            image = chinfo2.fitsimage.get_image()
            if image is None:
                continue
            ort = wcs.get_relative_orientation(image, self.ref_image)

            new_scale_x, new_scale_y = (ort.rscale_x * chg_x,
                                        ort.rscale_y * chg_y)
            # apply that scale
            self.logger.info("changing scale for channel '%s' to %f,%f" % (
                chinfo2.name, new_scale_x, new_scale_y))
            chinfo2.fitsimage.scale_to(new_scale_x, new_scale_y)
Beispiel #5
0
    def redo(self):
        if self.ref_image is None:
            # no reference image
            return

        chinfo = self.fv.get_channel_info()
        viewer = chinfo.fitsimage

        image = viewer.get_image()
        ## if image == self.ref_image:
        ##     # current image is same as reference image
        ##     return

        info = wcs.get_relative_orientation(image, self.ref_image)
        self.logger.info("rscale_x=%f rscale_y=%f rrot_deg=%f" %
                         (info.rscale_x, info.rscale_y, info.rrot_deg))
Beispiel #6
0
    def redo(self):
        if self.ref_image is None:
            # no reference image
            return

        chinfo = self.fv.get_channelInfo(chname)
        viewer = chinfo.fitsimage

        image = viewer.get_image()
        ## if image == self.ref_image:
        ##     # current image is same as reference image
        ##     return

        info = wcs.get_relative_orientation(image, self.ref_image)
        self.logger.info("rscale_x=%f rscale_y=%f rrot_deg=%f" % (
            info.rscale_x, info.rscale_y, info.rrot_deg))