예제 #1
0
    def pix(self, x=10, y=10, z=10, c=3, t=50, client=None):
        """
        Creates an int8 pixel of the given size in the database.
        No data is written.
        """
        image = self.new_image()
        pixels = PixelsI()
        pixels.sizeX = rint(x)
        pixels.sizeY = rint(y)
        pixels.sizeZ = rint(z)
        pixels.sizeC = rint(c)
        pixels.sizeT = rint(t)
        pixels.sha1 = rstring("")
        pixels.pixelsType = PixelsTypeI()
        pixels.pixelsType.value = rstring("int8")
        pixels.dimensionOrder = DimensionOrderI()
        pixels.dimensionOrder.value = rstring("XYZCT")
        image.addPixels(pixels)

        if client is None:
            client = self.client
        update = client.sf.getUpdateService()
        image = update.saveAndReturnObject(image)
        pixels = image.getPrimaryPixels()
        return pixels
예제 #2
0
    def pix(self, x=10, y=10, z=10, c=3, t=50, client=None):
        """
        Creates an int8 pixel of the given size in the database.
        No data is written.
        """
        image = self.new_image()
        pixels = PixelsI()
        pixels.sizeX = rint(x)
        pixels.sizeY = rint(y)
        pixels.sizeZ = rint(z)
        pixels.sizeC = rint(c)
        pixels.sizeT = rint(t)
        pixels.sha1 = rstring("")
        pixels.pixelsType = PixelsTypeI()
        pixels.pixelsType.value = rstring("int8")
        pixels.dimensionOrder = DimensionOrderI()
        pixels.dimensionOrder.value = rstring("XYZCT")
        image.addPixels(pixels)

        if client is None:
            client = self.client
        update = client.sf.getUpdateService()
        image = update.saveAndReturnObject(image)
        pixels = image.getPrimaryPixels()
        return pixels
예제 #3
0
def create_image(image_index):
    image = ImageI()
    image.name = rstring("%s_%d" % (uuid(), image_index))
    image.acquisitionDate = rtime(0)
    pixels = PixelsI()
    pixels.sha1 = rstring("")
    pixels.sizeX = rint(1)
    pixels.sizeY = rint(1)
    pixels.sizeZ = rint(1)
    pixels.sizeC = rint(1)
    pixels.sizeT = rint(1)
    pixels.dimensionOrder = DimensionOrderI(1L, False)  # XYZCT
    pixels.pixelsType = PixelsTypeI(1L, False)  # bit
    image.addPixels(pixels)
    return image
예제 #4
0
def create_image(image_index):
    image = ImageI()
    image.name = rstring('%s_%d' % (uuid(), image_index))
    image.acquisitionDate = rtime(0)
    pixels = PixelsI()
    pixels.sha1 = rstring('')
    pixels.sizeX = rint(1)
    pixels.sizeY = rint(1)
    pixels.sizeZ = rint(1)
    pixels.sizeC = rint(1)
    pixels.sizeT = rint(1)
    pixels.dimensionOrder = DimensionOrderI(1L, False)  # XYZCT
    pixels.pixelsType = PixelsTypeI(1L, False)  # bit
    image.addPixels(pixels)
    return image
예제 #5
0
def create_image(image_id, with_pixels=False):
    image_format = FormatI(1L)
    image_format.value = rstring("PNG")

    image = ImageI()
    image.id = rlong(image_id)
    image.acquisitionDate = rtime(1L)
    image.archived = rbool(False)
    image.description = rstring("image_description_%d" % image_id)
    image.name = rstring("image_name_%d" % image_id)
    image.partial = rbool(False)
    image.series = rint(0)
    image.format = image_format
    if not with_pixels:
        return image
    dimension_order = DimensionOrderI(1L)
    dimension_order.value = rstring("XYZCT")
    pixels_type = PixelsTypeI(1L)
    pixels_type.value = "bit"

    pixels = PixelsI(1L)
    pixels.methodology = rstring("methodology")
    pixels.physicalSizeX = LengthI(1.0, UnitsLength.MICROMETER)
    pixels.physicalSizeY = LengthI(2.0, UnitsLength.MICROMETER)
    pixels.physicalSizeZ = LengthI(3.0, UnitsLength.MICROMETER)
    pixels.sha1 = rstring("61ee8b5601a84d5154387578466c8998848ba089")
    pixels.significantBits = rint(16)
    pixels.sizeX = rint(1)
    pixels.sizeY = rint(2)
    pixels.sizeZ = rint(3)
    pixels.sizeC = rint(4)
    pixels.sizeT = rint(5)
    pixels.timeIncrement = TimeI(1.0, UnitsTime.MILLISECOND)
    pixels.waveIncrement = rdouble(2.0)
    pixels.waveStart = rint(1)
    pixels.dimensionOrder = dimension_order
    pixels.pixelsType = pixels_type
    image.addPixels(pixels)

    contrast_method = ContrastMethodI(8L)
    contrast_method.value = rstring("Fluorescence")
    illumination = IlluminationI(1L)
    illumination.value = rstring("Transmitted")
    acquisition_mode = AcquisitionModeI(1L)
    acquisition_mode.value = rstring("WideField")
    photometric_interpretation = PhotometricInterpretationI(1L)
    photometric_interpretation.value = rstring("RGB")

    channel_1 = ChannelI(1L)
    channel_1.alpha = rint(255)
    channel_1.blue = rint(0)
    channel_1.green = rint(255)
    channel_1.red = rint(0)
    channel_1.lookupTable = rstring("rainbow")
    logical_channel_1 = LogicalChannelI(1L)
    logical_channel_1.emissionWave = LengthI(509.0, UnitsLength.NANOMETER)
    logical_channel_1.excitationWave = LengthI(488.0, UnitsLength.NANOMETER)
    logical_channel_1.fluor = rstring("GFP")
    logical_channel_1.name = rstring("GFP/488")
    logical_channel_1.ndFilter = rdouble(1.0)
    logical_channel_1.pinHoleSize = LengthI(1.0, UnitsLength.NANOMETER)
    logical_channel_1.pockelCellSetting = rint(0)
    logical_channel_1.samplesPerPixel = rint(2)
    logical_channel_1.contrastMethod = contrast_method
    logical_channel_1.illumination = illumination
    logical_channel_1.mode = acquisition_mode
    logical_channel_1.photometricInterpretation = photometric_interpretation
    channel_1.logicalChannel = logical_channel_1

    channel_2 = ChannelI(2L)
    channel_2.alpha = rint(255)
    channel_2.blue = rint(255)
    channel_2.green = rint(0)
    channel_2.red = rint(0)
    channel_2.lookupTable = rstring("rainbow")
    logical_channel_2 = LogicalChannelI(2L)
    logical_channel_2.emissionWave = LengthI(470.0, UnitsLength.NANOMETER)
    logical_channel_2.excitationWave = LengthI(405.0, UnitsLength.NANOMETER)
    logical_channel_2.fluor = rstring("DAPI")
    logical_channel_2.name = rstring("DAPI/405")
    logical_channel_2.ndFilter = rdouble(1.0)
    logical_channel_2.pinHoleSize = LengthI(2.0, UnitsLength.NANOMETER)
    logical_channel_2.pockelCellSetting = rint(0)
    logical_channel_2.samplesPerPixel = rint(2)
    logical_channel_2.contrastMethod = contrast_method
    logical_channel_2.illumination = illumination
    logical_channel_2.mode = acquisition_mode
    logical_channel_2.photometricInterpretation = photometric_interpretation
    channel_2.logicalChannel = logical_channel_2

    pixels.addChannel(channel_1)
    pixels.addChannel(channel_2)
    return image
예제 #6
0
def create_image(image_id, with_pixels=False):
    image_format = FormatI(1)
    image_format.value = rstring('PNG')

    image = ImageI()
    image.id = rlong(image_id)
    image.acquisitionDate = rtime(1)
    image.archived = rbool(False)
    image.description = rstring('image_description_%d' % image_id)
    image.name = rstring('image_name_%d' % image_id)
    image.partial = rbool(False)
    image.series = rint(0)
    image.format = image_format
    if not with_pixels:
        return image
    dimension_order = DimensionOrderI(1)
    dimension_order.value = rstring('XYZCT')
    pixels_type = PixelsTypeI(1)
    pixels_type.value = 'bit'

    pixels = PixelsI(1)
    pixels.methodology = rstring('methodology')
    pixels.physicalSizeX = LengthI(1.0, UnitsLength.MICROMETER)
    pixels.physicalSizeY = LengthI(2.0, UnitsLength.MICROMETER)
    pixels.physicalSizeZ = LengthI(3.0, UnitsLength.MICROMETER)
    pixels.sha1 = rstring('61ee8b5601a84d5154387578466c8998848ba089')
    pixels.significantBits = rint(16)
    pixels.sizeX = rint(1)
    pixels.sizeY = rint(2)
    pixels.sizeZ = rint(3)
    pixels.sizeC = rint(4)
    pixels.sizeT = rint(5)
    pixels.timeIncrement = TimeI(1.0, UnitsTime.MILLISECOND)
    pixels.waveIncrement = rdouble(2.0)
    pixels.waveStart = rint(1)
    pixels.dimensionOrder = dimension_order
    pixels.pixelsType = pixels_type
    image.addPixels(pixels)

    contrast_method = ContrastMethodI(8)
    contrast_method.value = rstring('Fluorescence')
    illumination = IlluminationI(1)
    illumination.value = rstring('Transmitted')
    acquisition_mode = AcquisitionModeI(1)
    acquisition_mode.value = rstring('WideField')
    photometric_interpretation = PhotometricInterpretationI(1)
    photometric_interpretation.value = rstring('RGB')

    channel_1 = ChannelI(1)
    channel_1.alpha = rint(255)
    channel_1.blue = rint(255)
    channel_1.green = rint(255)
    channel_1.red = rint(255)
    channel_1.lookupTable = rstring('rainbow')
    logical_channel_1 = LogicalChannelI(1)
    logical_channel_1.emissionWave = LengthI(509.0, UnitsLength.NANOMETER)
    logical_channel_1.excitationWave = LengthI(488.0, UnitsLength.NANOMETER)
    logical_channel_1.fluor = rstring('GFP')
    logical_channel_1.name = rstring('GFP/488')
    logical_channel_1.ndFilter = rdouble(1.0)
    logical_channel_1.pinHoleSize = LengthI(1.0, UnitsLength.NANOMETER)
    logical_channel_1.pockelCellSetting = rint(0)
    logical_channel_1.samplesPerPixel = rint(2)
    logical_channel_1.contrastMethod = contrast_method
    logical_channel_1.illumination = illumination
    logical_channel_1.mode = acquisition_mode
    logical_channel_1.photometricInterpretation = photometric_interpretation
    channel_1.logicalChannel = logical_channel_1

    channel_2 = ChannelI(2)
    channel_2.alpha = rint(255)
    channel_2.blue = rint(255)
    channel_2.green = rint(0)
    channel_2.red = rint(255)
    channel_2.lookupTable = rstring('rainbow')
    logical_channel_2 = LogicalChannelI(2)
    logical_channel_2.emissionWave = LengthI(470.0, UnitsLength.NANOMETER)
    logical_channel_2.excitationWave = LengthI(405.0, UnitsLength.NANOMETER)
    logical_channel_2.fluor = rstring('DAPI')
    logical_channel_2.name = rstring('DAPI/405')
    logical_channel_2.ndFilter = rdouble(1.0)
    logical_channel_2.pinHoleSize = LengthI(2.0, UnitsLength.NANOMETER)
    logical_channel_2.pockelCellSetting = rint(0)
    logical_channel_2.samplesPerPixel = rint(2)
    logical_channel_2.contrastMethod = contrast_method
    logical_channel_2.illumination = illumination
    logical_channel_2.mode = acquisition_mode
    logical_channel_2.photometricInterpretation = photometric_interpretation
    channel_2.logicalChannel = logical_channel_2

    pixels.addChannel(channel_1)
    pixels.addChannel(channel_2)
    return image