Пример #1
0
 def flip(self, surface, xbool=True, ybool=False):
     """
     Return Surface that is flipped horizontally, vertically, or both.
     """
     if xbool and ybool:
         at = AffineTransform.getScaleInstance(-1, -1)
         at.translate(-surface.getHeight(), -surface.getHeight())
     elif xbool:
         at = AffineTransform.getScaleInstance(-1, 1)
         at.translate(-surface.getWidth(), 0)
     elif ybool:
         at = AffineTransform.getScaleInstance(1, -1)
         at.translate(0, -surface.getHeight())
     else:
         return surface
     op = AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR)
     bimage = op.filter(surface, None)
     surf = Surface(bimage)
     return surf
Пример #2
0
 def flip(self, surface, xbool=True, ybool=False):
     """
     Return Surface that is flipped horizontally, vertically, or both.
     """
     if xbool and ybool:
         at = AffineTransform.getScaleInstance(-1, -1)
         at.translate(-surface.getHeight(), -surface.getHeight())
     elif xbool:
         at = AffineTransform.getScaleInstance(-1, 1)
         at.translate(-surface.getWidth(), 0)
     elif ybool:
         at = AffineTransform.getScaleInstance(1, -1)
         at.translate(0, -surface.getHeight())
     else:
         return surface
     op = AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR)
     bimage = op.filter(surface, None)
     surf = Surface(bimage)
     return surf
Пример #3
0
        #////////////////////////////
        targetImage = images[0]
        targetProcessor = targetImage.getProcessor()
        targetHeight = float(targetProcessor.getHeight())
        targetWidth = float(targetProcessor.getWidth())

	#////////////////////////////
        # Determine scaling information, scaling target image rois to mass images size.
        #////////////////////////////
        scalingHeight = float(targetHeight/height)
        scalingWidth = float(targetHeight/width)

	#////////////////////////////
        # Loop through rois in IJ roi manager, scale them, then add to OpenMIMS images
        #////////////////////////////
        rois = IJRoiManager.getRoisAsArray()
        for i in range(len(rois)):
          roi = rois[i]
          polygon = roi.getPolygon()
          at = AfTransform.getScaleInstance(scalingHeight, scalingWidth)
          roi = ShapeRoi(at.createTransformedShape(polygon)).shapeToRoi()
          MIMSRoiManager.add(roi)

        #////////////////////////////
        # Update all the images and open the OpenMimsRoi manager
        #////////////////////////////
        ui.updateAllImages()
        MIMSRoiManager.viewManager()

        
Пример #4
0
                #////////////////////////////
                targetImage = images[0]
                targetProcessor = targetImage.getProcessor()
                targetHeight = float(targetProcessor.getHeight())
                targetWidth = float(targetProcessor.getWidth())

                #////////////////////////////
                # Determine scaling information, scaling target image rois to mass images size.
                #////////////////////////////
                scalingHeight = float(targetHeight / height)
                scalingWidth = float(targetHeight / width)

                #////////////////////////////
                # Loop through rois in IJ roi manager, scale them, then add to OpenMIMS images
                #////////////////////////////
                rois = IJRoiManager.getRoisAsArray()
                for i in range(len(rois)):
                    roi = rois[i]
                    polygon = roi.getPolygon()
                    at = AfTransform.getScaleInstance(scalingHeight,
                                                      scalingWidth)
                    roi = ShapeRoi(
                        at.createTransformedShape(polygon)).shapeToRoi()
                    MIMSRoiManager.add(roi)

                #////////////////////////////
                # Update all the images and open the OpenMimsRoi manager
                #////////////////////////////
                ui.updateAllImages()
                MIMSRoiManager.viewManager()