fibresem/core/fibresem.py
def annotate(self, addscalebar=True, addsamplename=True):
        """
        Add annotations to image:
        - a scalebar in the lower right corner
        - sample name in the lower left corner
        """

        # Is an image loaded?
        if self.Data is None:
            if not self.loadImage():
                return None  # No image loaded

        # Crop image
        if not self.crop_square():
            return None

        img = self.Data

        # Create Matplotlib figure
        f = plt.figure(
            figsize=(img.shape[1] / 300, img.shape[0] / 300)
        )  # figure with correct aspect ratio
        ax = plt.axes((0, 0, 1, 1))  # axes over whole figure
        ax.imshow(img, cmap="gray", vmin=0, vmax=255)
        ax.axis("off")

        # Add annotations
        if addscalebar:
            self.addScalebar(ax)

        if addsamplename:
            self.addSampleName(ax)

        # Save figure
        self.saveFigure(plt)

        # Unload image to save memory
        if not KEEP_IN_MEMORY:
            self.unloadImage()

        return True

        Add annotations to image:
        - a scalebar in the lower right corner
        - sample name in the lower left corner
        
Add annotations to image:
a scalebar in the lower right corner
sample name in the lower left corner
Add annotations to image : a scalebar in the lower right corner sample name in the lower left corner
def annotate(self, addscalebar=True, addsamplename=True):
        if self.Data is None:
            if not self.loadImage():
                return None  
        if not self.crop_square():
            return None
        img = self.Data
        f = plt.figure(
            figsize=(img.shape[1] / 300, img.shape[0] / 300)
        )  
        ax = plt.axes((0, 0, 1, 1))  
        ax.imshow(img, cmap="gray", vmin=0, vmax=255)
        ax.axis("off")
        if addscalebar:
            self.addScalebar(ax)
        if addsamplename:
            self.addSampleName(ax)
        self.saveFigure(plt)
        if not KEEP_IN_MEMORY:
            self.unloadImage()
        return True
def annotate ( self , addscalebar = True , addsamplename = True ) : if self . Data is None : if not self . loadImage ( ) : return None if not self . crop_square ( ) : return None img = self . Data f = plt . figure ( figsize = ( img . shape [ 1 ] / 300 , img . shape [ 0 ] / 300 ) ) ax = plt . axes ( ( 0 , 0 , 1 , 1 ) ) ax . imshow ( img , cmap = "gray" , vmin = 0 , vmax = 255 ) ax . axis ( "off" ) if addscalebar : self . addScalebar ( ax ) if addsamplename : self . addSampleName ( ax ) self . saveFigure ( plt ) if not KEEP_IN_MEMORY : self . unloadImage ( ) return True
Add annotations to image:
 a scalebar in the lower right corner
 sample name in the lower left corner
Add annotations to image : a scalebar in the lower right corner sample name in the lower left corner
"""
        Add annotations to image:
        - a scalebar in the lower right corner
        - sample name in the lower left corner
        """ # Is an image loaded? # No image loaded # Crop image # Create Matplotlib figure # figure with correct aspect ratio # axes over whole figure # Add annotations # Save figure # Unload image to save memory
self
addscalebar
addsamplename