def __init__(self, image_file): '''Initialise the image structure from the given file, including a proper model of the experiment.''' assert(self.understand(image_file)) FormatTIFFRayonix.__init__(self, image_file) return
def __init__(self, image_file, **kwargs): '''Initialise the image structure from the given file, including a proper model of the experiment.''' assert (self.understand(image_file)) FormatTIFFRayonix.__init__(self, image_file, **kwargs) return
def __init__(self, image_file, **kwargs): """Initialise the image structure from the given file, including a proper model of the experiment.""" from dxtbx import IncorrectFormatError if not self.understand(image_file): raise IncorrectFormatError(self, image_file) FormatTIFFRayonix.__init__(self, image_file, **kwargs)
def __init__(self, image_file, **kwargs): '''Initialise the image structure from the given file, including a proper model of the experiment.''' assert(self.understand(image_file)) from iotbx.detectors.mar import MARImage MARImage._read_header_asserts = lambda self: None FormatTIFFRayonix.__init__(self, image_file, **kwargs) return
def __init__(self, image_file, **kwargs): '''Initialise the image structure from the given file, including a proper model of the experiment.''' assert (self.understand(image_file)) from iotbx.detectors.mar import MARImage MARImage._read_header_asserts = lambda self: None FormatTIFFRayonix.__init__(self, image_file, **kwargs) return
def __init__(self, image_file, **kwargs): """Initialise the image structure from the given file, including a proper model of the experiment.""" from dxtbx import IncorrectFormatError if not self.understand(image_file): raise IncorrectFormatError(self, image_file) from iotbx.detectors.mar import MARImage MARImage._read_header_asserts = lambda self: None FormatTIFFRayonix.__init__(self, image_file, **kwargs)
def understand(image_file): """Check to see if this looks like an Rayonix TIFF format image, i.e. we can make sense of it. Returns true if the beam center is specified in pixels.""" width, height, depth, order, bytes = FormatTIFFRayonix.get_tiff_header( image_file) from scitbx.matrix import col from dxtbx.format.FormatTIFFHelpers import LITTLE_ENDIAN, BIG_ENDIAN format = {LITTLE_ENDIAN: "<", BIG_ENDIAN: ">"}[order] offset = 1024 detector_size_pixels = col( struct.unpack(format + "ii", bytes[offset + 80:offset + 88])) detector_center_px = 0.5 * detector_size_pixels # detector_pixel_sz_mm = 1.0e-6 * col( # convert from nano to milli # struct.unpack(format + "ii", bytes[offset + 772 : offset + 780]) # ) header_beam_center = 0.001 * col( # Rayonix says this should be pixels struct.unpack(format + "ii", bytes[offset + 644:offset + 652])) disagreement = header_beam_center[0] / detector_center_px[0] return (header_beam_center[0] > 0 and header_beam_center[1] > 0 and disagreement < 0.5 ) # if header was in mm, disagreement should be
def understand(image_file): '''Check to see if this looks like an Rayonix TIFF format image, i.e. we can make sense of it. Returns true if the beam center is specified in pixels.''' width, height, depth, order, bytes = FormatTIFFRayonix.get_tiff_header( image_file) import struct from scitbx.matrix import col from dxtbx.format.FormatTIFFHelpers import LITTLE_ENDIAN, BIG_ENDIAN format = {LITTLE_ENDIAN:'<', BIG_ENDIAN:'>'}[order] offset = 1024 detector_size_pixels = col(struct.unpack(format+'ii',bytes[offset+80:offset+88])) detector_center_px = 0.5 * detector_size_pixels detector_pixel_sz_mm = 1.E-6 * col( # convert from nano to milli struct.unpack(format+'ii',bytes[offset+772:offset+780])) header_beam_center = 0.001 * col( # Rayonix says this should be pixels struct.unpack(format+'ii',bytes[offset+644:offset+652])) disagreement = header_beam_center[0]/detector_center_px[0] return header_beam_center[0] > 0 and header_beam_center[1] > 0 \ and disagreement < 0.5 # if header was in mm, disagreement should be
def understand(image_file): """Check to see if this looks like an Rayonix TIFF format image, i.e. we can make sense of it. This simply checks that records which describe the size of the image match with the TIFF records which do the same.""" width, height, depth, order, bytes = FormatTIFFRayonix.get_tiff_header( image_file) serial_number = -1 for record in bytes[2464:2464 + 512].strip().split("\n"): if "detector serial number" in record.lower(): serial_number = int(record.split()[-1]) # only understand a square image if width != height: return # BL26B2 MX225 with 1X1, 2X2, 3X3 or 4X4 binning if serial_number == 24 and width in [6144, 3072, 2046, 1536]: return True # BL32XU MX225-HE with 1X1, 2X2, 3X3 or 4X4 binning if serial_number == 31 and width in [6144, 3072, 2046, 1536]: return True # BL44XU MX225-HE with 1X1, 2X2, 3X3 or 4X4 binning if serial_number == 38 and width in [6144, 3072, 2046, 1536]: return True # BL44XU MX300-HE with 1X1, 2X2, 3X3 or 4X4 binning if serial_number == 42 and width in [8192, 4096, 2728, 2048]: return True # BL41XU MX225-HE with 1X1, 2X2, 3X3 or 4X4 binning if serial_number == 40 and width in [6144, 3072, 2046, 1536]: return True # BL32XU MX225-HS 1X1, 2X2, 3X3, 4X4, 5X5, 6X6, 8X8 or 10X10 binning if serial_number == 106 and width in [ 5760, 2880, 1920, 1440, 1152, 960, 720, 576, ]: return True return False
def understand(image_file): '''Check to see if this looks like an Rayonix TIFF format image, i.e. we can make sense of it. This simply checks that records which describe the size of the image match with the TIFF records which do the same.''' width, height, depth, order, bytes = FormatTIFFRayonix.get_tiff_header( image_file) serial_number = -1 for record in bytes[2464:2464+512].strip().split('\n'): if 'detector serial number' in record.lower(): serial_number = int(record.split()[-1]) # only understand a square image if width != height: return # BL26B2 MX225 with 1X1, 2X2, 3X3 or 4X4 binning if serial_number == 24 and width in [6144, 3072, 2046, 1536]: return True # BL32XU MX225-HE with 1X1, 2X2, 3X3 or 4X4 binning if serial_number == 31 and width in [6144, 3072, 2046, 1536]: return True # BL44XU MX225-HE with 1X1, 2X2, 3X3 or 4X4 binning if serial_number == 38 and width in [6144, 3072, 2046, 1536]: return True # BL44XU MX300-HE with 1X1, 2X2, 3X3 or 4X4 binning if serial_number == 42 and width in [8192, 4096, 2728, 2048]: return True # BL41XU MX225-HE with 1X1, 2X2, 3X3 or 4X4 binning if serial_number == 40 and width in [6144, 3072, 2046, 1536]: return True # BL32XU MX225-HS 1X1, 2X2, 3X3, 4X4, 5X5, 6X6, 8X8 or 10X10 binning if serial_number == 106 and width in [5760, 2880, 1920, 1440, 1152, 960, 720, 576]: return True
def _get_rayonix_scan_angles(self): return check(FormatTIFFRayonix._get_rayonix_scan_angles(self))
def _get_rayonix_detector_rotations(self): return check(FormatTIFFRayonix._get_rayonix_detector_rotations(self))
def _get_rayonix_distance(self): return check(FormatTIFFRayonix._get_rayonix_distance(self))
def _get_rayonix_pixel_size(self): return check(FormatTIFFRayonix._get_rayonix_pixel_size(self))
def _get_rayonix_timestamp(self): return check(FormatTIFFRayonix._get_rayonix_timestamp(self))
def _get_rayonix_times(self): return check(FormatTIFFRayonix._get_rayonix_times(self))