Exemple #1
0
 def ShowSourceSlide(self):
     if os.path.exists(self.filename):
         arr = HamaWrapper.getSlideImage(self.filename)
         im = Image.frombuffer("RGB", (arr.shape[2], arr.shape[1]), arr.data)
         im.show()
     else:
         print "Error: File not found!"
Exemple #2
0
 def GetMap(self, desired_frame_width, desired_frame_height):
     """Arguments:
     frame_width: long with the width in pixel.
     frame_height: long with the height in pixel.
     """
     if os.path.exists(self.filename):
         return HamaWrapper.getMap(self.filename, desired_frame_width, desired_frame_height)
     else:
         print "Error: File not found!"
Exemple #3
0
 def ShowMap(self, desired_frame_width, desired_frame_height):
     """Arguments:
     frame_width: long with the width in pixel.
     frame_height: long with the height in pixel.
     """
     if os.path.exists(self.filename):
         arr = HamaWrapper.getMap(self.filename, desired_frame_width, desired_frame_height)
         im = Image.frombuffer("RGB", (arr.shape[2], arr.shape[1]), arr.data)
         im.show()
     else:
         print "Error: File not found!"
Exemple #4
0
 def GetImageData(self, frame_width, frame_height, x_center, y_center, z_plan, magnification):
     """Arguments:
     frame_width: long with the width in pixel.
     frame_height: long with the height in pixel.
     x_center: long with the physical X pos of the desired image in nm.
     y_center: long with the physical Y pos of the desired image in nm.
     z_plan: long with the physical Z (focal) pos of the desired image in nm.
     magnification: long with the objective magnification.
     """
     if os.path.exists(self.filename):
         return HamaWrapper.getImageData(
             self.filename, frame_width, frame_height, x_center, y_center, z_plan, magnification
         )
     else:
         print "Error: File not found!"
Exemple #5
0
 def GetImageDataNm(self, physical_width, physical_height, x_center, y_center, z_plan, magnification):
     """Arguments:
     physical_width: long with the width in nm.
     physical_height: long with the height in nm.
     x_center: long with the physical X pos of the desired image in nm.
     y_center: long with the physical Y pos of the desired image in nm.
     z_plan: long with the physical Z (focal) pos of the desired image in nm.
     magnification: long with the objective magnification.
     """
     width = round(magnification * physical_width / self.CONV_FACT) + 1
     height = round(magnification * physical_height / self.CONV_FACT) + 1
     if os.path.exists(self.filename):
         return HamaWrapper.getImageData(self.filename, width, height, x_center, y_center, z_plan, magnification)
     else:
         print "Error: File not found!"
Exemple #6
0
 def GetImageNm(self, physical_width, physical_height, x_coord, y_coord, z_depth, magnification):
     """Arguments:
     physical_width: long with the width in nm.
     physical_height: long with the height in nm.
     x_center: long with the physical X pos of the desired image in nm.
     y_center: long with the physical Y pos of the desired image in nm.
     z_plan: long with the physical Z (focal) pos of the desired image in nm.
     magnification: long with the objective magnification.
     """
     width = round(1.0 * magnification * physical_width / self.CONV_FACT) + 1
     height = round(1.0 * magnification * physical_height / self.CONV_FACT) + 1
     if os.path.exists(self.filename):
         arr = HamaWrapper.getImageData(self.filename, width, height, x_coord, y_coord, z_depth, magnification)
         im = Image.frombuffer("RGB", (arr.shape[2], arr.shape[1]), arr.data)
         return im
     else:
         print "Error: File not found!"
Exemple #7
0
 def GetImage(self, desired_frame_width, desired_frame_height, x_coord, y_coord, z_depth, magnification):
     """Arguments:
     frame_width: long with the width in pixel.
     frame_height: long with the height in pixel.
     x_center: long with the physical X pos of the desired image in nm.
     y_center: long with the physical Y pos of the desired image in nm.
     z_plan: long with the physical Z (focal) pos of the desired image in nm.
     magnification: long with the objective magnification.
     """
     if os.path.exists(self.filename):
         arr = HamaWrapper.getImageData(
             self.filename, desired_frame_width, desired_frame_height, x_coord, y_coord, z_depth, magnification
         )
         im = Image.frombuffer("RGB", (arr.shape[2], arr.shape[1]), arr.data)
         return im
     else:
         print "Error: File not found!"
Exemple #8
0
 def GetSlideImage(self):
     if os.path.exists(self.filename):
         return HamaWrapper.getSlideImage(self.filename)
     else:
         print "Error: File not found!"
Exemple #9
0
 def GetSourcePixelSize(self):
     if os.path.exists(self.filename):
         return HamaWrapper.getSourcePixelSize(self.filename)
     else:
         print "Error: File not found!"
Exemple #10
0
 def ColorConvolution(self, width, height, x, y, z, mag, stain_matrix):
     if os.path.exists(self.filename):
         arr = HamaWrapper.convolution(self.filename, width, height, x, y, z, mag, stain_matrix)
         return arr
     else:
         print "Error: File not found!"
Exemple #11
0
 def GetLastErrorMessage(self):
     print HamaWrapper.getLastErrorMessage()
Exemple #12
0
 def CleanUp(self):
     return HamaWrapper.cleanUp()