Class SimpleImageDataConfig

    • Constructor Detail

      • SimpleImageDataConfig

        public SimpleImageDataConfig()
    • Method Detail

      • extractImageMetadata

        public ImageMetadata extractImageMetadata​(java.lang.String imagePath)
        Extracts tile number, channel code and well code for a given relative path to a single image. This method should overridden to deal with files containing single images. It is ignored if extractImagesMetadata(String, List) is overridden as well.

        It will be called for each file found in the incoming directory which has the extension returned by getRecognizedImageExtensions().

        To deal with image containers (like multi-page TIFF files) override extractImagesMetadata(String, List) instead, otherwise leave that method unchanged.
      • extractImagesMetadata

        public ImageMetadata[] extractImagesMetadata​(java.lang.String imagePath,
                                                     java.util.List<ImageIdentifier> imageIdentifiers)
        Returns meta-data for each image in the specified image container. This method should overridden to deal with container images (like multi-page TIFF files).

        This implementation returns the result of extractImageMetadata(String) wrapped in an array, image identifiers are ignored.

        imagePath - path to the single image or container of many images
        imageIdentifiers - Identifiers of all images contained in the image file.
      • getTileGeometry

        public Geometry getTileGeometry​(java.util.List<? extends ImageMetadata> imageMetadataList,
                                        int maxTileNumber)
        By default layouts all images in one row by returning (1, maxTileNumber) geometry.Can be overridden in subclasses.
        imageMetadataList - a list of metadata for each encountered image
        maxTileNumber - the biggest tile number among all encountered images
        the width and height of the matrix of tiles (a.k.a. fields or sides) in the well.
      • createChannel

        public Channel createChannel​(java.lang.String channelCode)

        Creates channel description for a given code. Can be overridden in subclasses.

        By default the channel label will be equal to the code. Channel color returned by getChannelColor(String) will be used.
      • getAvailableChannelTransformations

        public ImageTransformation[] getAvailableChannelTransformations​(java.lang.String channelCode)
        Sets available transformations which can be applied to images of the specified channel (on user's request).

        Can be overridden in subclasses. The easiest way to create transformations is to use ImageTransformationBuffer class.

        By default returns null.

      • getChannelColorRGB

        public ChannelColorRGB getChannelColorRGB​(java.lang.String channelCode)
        Returns RGB color for the specified channel. It will be used to display merged channels images.

        Can be overridden in subclasses. It is ignored if createChannel(String) is overridden as well. One should not override getChannelColor(String) and getChannelColorRGB(String) at the same time.

        By default returns null (the arbitrary color will be set).
      • getPlateSpace

        public java.lang.String getPlateSpace()
      • getProjectCode

        public java.lang.String getProjectCode()
      • getPlateCode

        public java.lang.String getPlateCode()
      • getRecognizedImageExtensions

        public java.lang.String[] getRecognizedImageExtensions()
      • isGenerateThumbnails

        public boolean isGenerateThumbnails()
      • getMaxThumbnailWidthAndHeight

        public int getMaxThumbnailWidthAndHeight()
      • getAllowedMachineLoadDuringThumbnailsGeneration

        public double getAllowedMachineLoadDuringThumbnailsGeneration()
      • isStoreChannelsOnExperimentLevel

        public boolean isStoreChannelsOnExperimentLevel()
      • tryGetConvertTransformationCliArguments

        public java.lang.String tryGetConvertTransformationCliArguments()
      • getComputeCommonIntensityRangeOfAllImagesForChannels

        public java.util.List<java.lang.String> getComputeCommonIntensityRangeOfAllImagesForChannels()
      • getComputeCommonIntensityRangeOfAllImagesThreshold

        public float getComputeCommonIntensityRangeOfAllImagesThreshold()
      • isFixedIntensityRangeForAllImagesDefined

        public boolean isFixedIntensityRangeForAllImagesDefined()
      • getFixedIntensityRangeForAllImages

        public java.util.Map<java.lang.String,​IntensityRange> getFixedIntensityRangeForAllImages()
      • getComputeCommonIntensityRangeOfAllImagesLabel

        public java.lang.String getComputeCommonIntensityRangeOfAllImagesLabel()
      • isComputeCommonIntensityRangeOfAllImagesDefault

        public boolean isComputeCommonIntensityRangeOfAllImagesDefault()
      • getChannels

        public java.util.List<Channel> getChannels()
      • getChannelColorComponentsOrNull

        public java.util.List<ChannelColorComponent> getChannelColorComponentsOrNull()
      • setPlate

        public void setPlate​(java.lang.String spaceCode,
                             java.lang.String plateCode)
        Sets the existing plate to which the dataset should belong.
        spaceCode - space where the plate for which the dataset has been acquired exist
        plateCode - code of the plate to which the dataset will belong
      • setRecognizedImageExtensions

        public void setRecognizedImageExtensions​(java.lang.String[] recognizedImageExtensions)
        Only files with these extensions will be recognized as images (e.g. ["jpg", "png"]).
        By default it is set to [ "tiff", "tif", "png", "gif", "jpg", "jpeg", "c01" ].
      • setChannels

        public void setChannels​(java.util.List<Channel> channels)
        Sets all channels available in the data set.
      • setChannels

        public void setChannels​(java.util.List<Channel> channels,
                                java.util.List<ChannelColorComponent> channelColorComponents)
        Use this method if channels are encoded in color components of one image (or in other words: each image contains merged channels). For each channel you have to specify the corresponding color component of the image.
      • setGenerateThumbnails

        public void setGenerateThumbnails​(boolean generateThumbnails)
        Removes all thumbnails generations specified in so far and sets default thumbnails to be generated, or leaves no thumbnails depending on the parameter value.
        generateThumbnails - Indicates whether thumbnails should be generated.
      • setGenerateImageRepresentations

        public void setGenerateImageRepresentations​(IThumbnailsConfiguration[] formats)
        Registers a request for alternate image representations to be generated based on the original image. The format of the alternate representations is specified by the IThumbnailsConfiguration formats argument.
        formats - The formats of the image generated representations. One image representation will be created for each format.
      • setGenerateImageRepresentationsUsingScaleFactors

        public void setGenerateImageRepresentationsUsingScaleFactors​(double[] scaleFactors)
        Registers a request for alternate image representations to be generated based on the original image. The alternate image representations vary with respect to resolution from the original image.
        scaleFactors - The scale factors applied to the original resolution. Scale factors must be greater than 0.
      • addGeneratedImageRepresentationWithScale

        public IThumbnailsConfiguration addGeneratedImageRepresentationWithScale​(double scale)
        Registers a request for an alternate image representation to be generated based on the original image. The alternate image representations vary with respect to resolution from the original image.
        scale - The scale factor applied to the original resolution. Scale factors must be greater than 0.
        The configuration for the image representation
      • setGenerateImageRepresentationsUsingImageResolutions

        public void setGenerateImageRepresentationsUsingImageResolutions​(java.lang.String[] resolutions)
        Registers a request for alternate image representations to be generated based on the original image. The alternate image representations vary with respect to resolution from the original image. By default, allow enlarging. Use setGenerateImageRepresentationsWithoutEnlargingUsingImageResolutions(String[]) to explicitly prevent enlarging.
        resolutions - The resolutions
      • setGenerateImageRepresentationsWithoutEnlargingUsingImageResolutions

        public void setGenerateImageRepresentationsWithoutEnlargingUsingImageResolutions​(java.lang.String[] resolutions)
        Registers a request for alternate image representations to be generated based on the original image. The alternate image representations vary with respect to resolution from the original image. This method throws an exception if the requested resolution results in the image being enlarged. Use setGenerateImageRepresentationsUsingImageResolutions(String[]) to allow enlarging.
        resolutions - The resolutions
      • addGeneratedImageRepresentationWithResolution

        public IThumbnailsConfiguration addGeneratedImageRepresentationWithResolution​(java.lang.String resolution)
        Registers a request for an alternate image representation to be generated based on the original image. The alternate image representations vary with respect to resolution from the original image. Enlarging is allowed. To prevent enlarging of the image, use addGeneratedImageRepresentationWithoutEnlargingWithResolution(java.lang.String).
        resolution - The resolution of the representation.
        The configuration for the image representation.
      • addGeneratedImageRepresentationWithoutEnlargingWithResolution

        public IThumbnailsConfiguration addGeneratedImageRepresentationWithoutEnlargingWithResolution​(java.lang.String resolution)
        Registers a request for an alternate image representation to be generated based on the original image. The alternate image representations vary with respect to resolution from the original image. Enlarging is not allowed. To allow enlarging of the image, use addGeneratedImageRepresentationWithResolution(java.lang.String).
        resolution - The resolution of the representation.
        The configuration for the image representation.
      • setMaxThumbnailWidthAndHeight

        public void setMaxThumbnailWidthAndHeight​(int maxThumbnailWidthAndHeight)
        the maximal width and height of the generated thumbnails
      • setAllowedMachineLoadDuringThumbnailsGeneration

        public void setAllowedMachineLoadDuringThumbnailsGeneration​(double allowedMachineLoadDuringThumbnailsGeneration)
        Valid only if thumbnails generation is switched on. Set it to a value lower than 1 if you want only some of your processor cores to be used for thumbnails generation. Number of threads that are used for thumbnail generation will be equal to: this constant * number of processor cores.
      • setUseImageMagicToGenerateThumbnails

        public void setUseImageMagicToGenerateThumbnails​(boolean generateWithImageMagic)
        Decides if ImageMagic 'convert' utility will be used to generate thumbnails. True by default.

        One should set this option to false and use the internal library if 'convert' tool is not installed or if many images are stored in one image container file.

      • getGenerateThumbnailsWithImageMagic

        public boolean getGenerateThumbnailsWithImageMagic()
      • setThumbnailsGenerationImageMagicParams

        public void setThumbnailsGenerationImageMagicParams​(java.lang.String[] imageMagicParams)
        Sets additional parameters which should be passed to ImageMagic 'convert' utility when it is used to generate thumbnails.

        Example: pass "-contrast-stretch 2%" to discard 2% of brightest and darkest pixels in the thumbnails.

      • getThumbnailsGenerationImageMagicParams

        public java.util.List<java.lang.String> getThumbnailsGenerationImageMagicParams()
      • setGenerateHighQuality8BitThumbnails

        public void setGenerateHighQuality8BitThumbnails​(boolean highQualityThumbnails)
        By default thumbnails are created in high-quality. But this is more time consuming. Set to false suppresses thumbnail creation in high quality. But this isn't recommended for 12-bit or 16-bit images. This flag is ignored if ImageMagic should be used for thumbnail generation.
      • getGenerateThumbnailsIn8BitHighQuality

        public boolean getGenerateThumbnailsIn8BitHighQuality()
      • setComputeCommonIntensityRangeOfAllImagesForAllChannels

        public void setComputeCommonIntensityRangeOfAllImagesForAllChannels()

        Can be used only for grayscale images, Useful when images do not use the whole available color depth of the format in which they are stored (e.g. 10 bits out of 12). By default switched off. Causes that the conversion to 8 bit color depth looses less information. At the same time allows to compare images of one dataset to each other.
        Warning: causes that all images have to be analysed before registration, this is a costly operation!

        If isComputed is set to true all dataset images will be analysed and one range of pixel intensities used across all images will be computed (with 0.5% threshold). The result will be saved and it will be possible to apply on-the-fly transformation when browsing images.

        Example: let's assume that all plate images are saved as 12 bit grayscales. Each image has ability to use pixel intensities from 0 to 4095. In our example only a range of the available intensities is used, let's say from 1024 to 2048. Before the image is displayed to the user it has to be converted to 8-bit color depth (range of intensities from 0 to 255). Without taking the effectively used intensities into account the range 1024...2048 would be converted to a range of 64..128 and other intensities would be unused. Analysing the images allows to convert 1024...2048 range to the full 0..255 range.

      • setComputeCommonIntensityRangeOfAllImagesForChannels

        public void setComputeCommonIntensityRangeOfAllImagesForChannels​(java.lang.String[] channelCodesOrNull)
        channelCodesOrNull - list of channel codes for which the optimal intensity rescaling parameters will be computed. If empty all channels will be analysed. If null nothing will be analysed (default behavior).
      • setComputeCommonIntensityRangeOfAllImagesLabel

        public void setComputeCommonIntensityRangeOfAllImagesLabel​(java.lang.String userFriendlyTransformationlabel)
        Set the label of the transformation which will rescale dataset images intensities in an optimal and comparable way. Can be used if the default value is not appropriate.

        See setComputeCommonIntensityRangeOfAllImagesForAllChannels() for details.

      • setDefaultFixedIntensityRangeForAllImages

        public void setDefaultFixedIntensityRangeForAllImages​(int minLevel,
                                                              int maxLevel)
        Sets fixed levels for the common intensity range transformation for all images. If this one is set, the automatic level computation is switched off which may give big performance improvements. If the method setComputeCommonIntensityRangeOfAllImagesForChannels(String[]) is not called, will set the transformation for all channels.
      • addFixedIntensityRangeForAllImages

        public void addFixedIntensityRangeForAllImages​(java.lang.String channelCode,
                                                       int minLevel,
                                                       int maxLevel)
        Add fixed levels for the common intensity range transformation of the given cannel for all images. If this one is set, the automatic level computation is switched off which can give big performance improvements.

        Note: If setDefaultFixedIntensityRangeForAllImages(int, int) is called as well, then the values provided here will overwrite the default values provided there for the channel channelCode. Otherwise, the common intensity transformation will only be computed for the channels where the levels have been set explicitly by this method.

      • setComputeCommonIntensityRangeOfAllImagesIsDefault

        public void setComputeCommonIntensityRangeOfAllImagesIsDefault​(boolean isDefault)
        Sets if the image transformation using common intensity range of all images should be the default choice when browsing images.

        True by default, which means e.g. that the 'image optimal' transformation will not be automatically available for users. However one can still add it explicitly with a chosen threshold by redefining getAvailableChannelTransformations(String) method.

      • setStoreChannelsOnExperimentLevel

        public void setStoreChannelsOnExperimentLevel​(boolean storeChannelsOnExperimentLevel)
        Should all dataset in one experiment use the same channels? By default set to false.
      • setOriginalDataStorageFormat

        public void setOriginalDataStorageFormat​(OriginalDataStorageFormat originalDataStorageFormat)
      • setConvertTransformationCliArguments

        public void setConvertTransformationCliArguments​(java.lang.String convertTransformationCliArguments)
        Sets parameters for the 'convert' command line tool, which will be used to apply an image transformation on the fly when an image is fetched.
      • setImageLibrary

        public void setImageLibrary​(java.lang.String imageLibraryName,
                                    java.lang.String readerName)
        Which image library and reader should be used to read the image?
        Available libraries [readers]:
        - IJ: [tiff]
        - ImageIO: [jpg, bmp, jpeg, wbmp, png, gif]
        - JAI: [pnm, jpeg, fpx, gif, tiff, wbmp, png, bmp]
        - BioFormats: [ZipReader, APNGReader, JPEGReader, PGMReader, FitsReader, PCXReader, GIFReader, BMPReader, IPLabReader, IvisionReader, DeltavisionReader, MRCReader, GatanReader, GatanDM2Reader, ImarisReader, OpenlabRawReader, OMEXMLReader, LIFReader, AVIReader, PictReader, SDTReader, EPSReader, SlidebookReader, AliconaReader, MNGReader, KhorosReader, VisitechReader, LIMReader, PSDReader, InCellReader, L2DReader, FEIReader, NAFReader, MINCReader, QTReader, MRWReader, TillVisionReader, ARFReader, CellomicsReader, LiFlimReader, TargaReader, OxfordInstrumentsReader, VGSAMReader, HISReader, WATOPReader, SeikoReader, TopometrixReader, UBMReader, QuesantReader, BioRadGelReader, RHKReader, MolecularImagingReader, CellWorxReader, Ecat7Reader, VarianFDFReader, AIMReader, FakeReader, JEOLReader, NiftiReader, AnalyzeReader, APLReader, NRRDReader, ICSReader, PerkinElmerReader, AmiraReader, ScanrReader, BDReader, UnisokuReader, PDSReader, BioRadReader, FV1000Reader, ZeissZVIReader, IPWReader, ND2Reader, JPEG2000Reader, PCIReader, ImarisHDFReader, ZeissLSMReader, SEQReader, GelReader, ImarisTiffReader, FlexReader, SVSReader, ImaconReader, LEOReader, JPKReader, MIASReader, TCSReader, LeicaReader, NikonReader, FluoviewReader, PrairieReader, MetamorphReader, MicromanagerReader, ImprovisionTiffReader, MetamorphTiffReader, NikonTiffReader, OMETiffReader, PhotoshopTiffReader, FEITiffReader, SimplePCITiffReader, NikonElementsTiffReader, TiffDelegateReader, TextReader, BurleighReader, OpenlabReader, DicomReader, SMCameraReader, SBIGReader]
      • setImageLibrary

        public void setImageLibrary​(java.lang.String imageLibraryName)
        Sets the image library to be used for reading images. Available libraries are: IJ, ImageIO, JAI, and BioFormats. The first image file is used to determine the actual reader. Note, that all images are read with the same image reader.
      • setRawImageDatasetType

        public void setRawImageDatasetType()
        Sets dataset type to the one which should be used for storing raw images. Marks the dataset as a "measured" one.
      • setOverviewImageDatasetType

        public void setOverviewImageDatasetType()
        Sets dataset type to the one which should be used for storing overview images generated from raw images. Marks the dataset as a "derived" one.
      • setSegmentationImageDatasetType

        public void setSegmentationImageDatasetType()
        Sets dataset type to the one which should be used for storing overlay images. Marks the dataset as a "derived" one.
      • setDataSetType

        public void setDataSetType​(java.lang.String datasetTypeCode)
        Sets the type of the dataset.
      • setFileFormatType

        public void setFileFormatType​(java.lang.String fileFormatCode)
        Sets the file type of the dataset.
      • setMeasuredData

        public void setMeasuredData​(boolean isMeasured)
        Set whether the data is measured or not. By default false.
      • setMicroscopyData

        public void setMicroscopyData​(boolean isMicroscopy)
        Sets the microscopy flag which is by default false. This flag is used to check whether well in ImageMetadata is specified or not. In case of microscopy well is ignored. Otherwise it is mandatory.
      • getDataSetType

        public java.lang.String getDataSetType()
      • getFileFormatType

        public java.lang.String getFileFormatType()
      • isMeasuredData

        public boolean isMeasuredData()
      • isMicroscopyData

        public boolean isMicroscopyData()
      • setThumbnailsFileFormat

        public void setThumbnailsFileFormat​(java.lang.String thumbnailsFileFormat)
      • getThumbnailsFileFormat

        public java.lang.String getThumbnailsFileFormat()
      • getColorDepth

        public java.lang.Integer getColorDepth()
      • setColorDepth

        public void setColorDepth​(java.lang.Integer colorDepth)