[ome-users] Read write large tiff

Melissa Linkert melissa at glencoesoftware.com
Fri Jun 1 01:18:06 BST 2012


Hi Erwan,

Thank you very much for the additional information; I can now duplicate
this problem.  It will be fixed with the upcoming 4.4 release of
Bio-Formats/OMERO.

Regards,
-Melissa

On Tue, May 29, 2012 at 09:11:23PM +0200, Erwan Bocher wrote:
> Hi Melissa,
> 
> Thanks a lot for your answer.
> >Hi Erwan,
> >
> >>I want to read, process and write a big tiff with the bioformats
> >>lib. I use the code proposed on the official wiki that permits to
> >>read data block by block. The code runs without any errors but the
> >>result image
> >>is wrong. Pixel values are shifted and the total size of the image
> >>is huge (original image 93 mo :  result image more than 600 mo).
> >What are the dimensions of the original file (X, Y, and number of
> >planes)?  Is the original image data compressed?
> Below all metadata from the source image :
> 
>  BitsPerPixel = 8
>  DimensionOrder = XYCZT
>  IsInterleaved = false
>  IsRGB = false
>  LittleEndian = true
>  PixelType = uint8
>  Series 0 Name = Nantes_93_lambert2.tif
>  SizeC = 3
>  SizeT = 1
>  SizeX = 4957
>  SizeY = 4213
>  SizeZ = 1
> BitsPerSample = 8
> Compression = Uncompressed
> ImageLength = 4213
> ImageWidth = 4957
> Location = /tmp/Nantes_93_lambert2.tif
> MetaDataPhotometricInterpretation = RGB
> MetaMorph = no
> NumberOfChannels = 3
> PhotometricInterpretation = RGB
> PlanarConfiguration = Planar
> SampleFormat = unsigned integer
> SamplesPerPixel = 3
> 
> ------------------------
> 
> Title: Nantes_93_lambert2.tif
> Width:  4957 pixels
> Height:  4213 pixels
> Depth:  1 pixels
> Voxel size: 1x1x1 pixel
> ID: -4
> Coordinate origin:  0,0,0
> Bits per pixel: 8 (grayscale LUT)
> Display range: 0-255
> Image: 1/3 (c:1/3 - Nantes_93_lambert2)
>   Channels: 3
>   Composite mode: "composite"
> No Threshold
> Magnification: 0.16666666666666666
> Uncalibrated
> Path: /tmp/Nantes_93_lambert2.tif
> No Selection
> 
> >
> >I would guess that the tile dimensions in the code need to be adjusted
> >(as alluded to on the wiki page), but without knowing the specifics of
> >the input file it's a little tricky to say for sure.
> By the way I have tested with a single tile in x (equals to the
> image width) and a tile heigth equals to 16 in y.
> The result is the same : very large image, pixels shifted...
> 
> 
> 
> Erwan
> >
> >Regards,
> >-Melissa
> >
> >On Tue, May 29, 2012 at 01:30:34PM +0200, Erwan Bocher wrote:
> >>Dear,
> >>
> >>I want to read, process and write a big tiff with the bioformats
> >>lib. I use the code proposed on the official wiki that permits to
> >>read data block by block. The code runs without any errors but the
> >>result image
> >>is wrong. Pixel values are shifted and the total size of the image
> >>is huge (original image 93 mo :  result image more than 600 mo).
> >>
> >>Thanks for any advice you could give!
> >>
> >>Greetings.
> >>
> >>
> >>                // create a reader that will automatically handle any
> >>supported format
> >>                 IFormatReader reader = new ImageReader();
> >>                 // tell the reader where to store the metadata from
> >>the dataset
> >>reader.setMetadataStore(MetadataTools.createOMEXMLMetadata());
> >>                 // initialize the dataset
> >>                 reader.setId(path);
> >>
> >>                 // create a writer that will automatically handle
> >>any supported output format
> >>                 IFormatWriter writer = new ImageWriter();
> >>                 // give the writer a MetadataRetrieve object, which
> >>encapsulates all of the
> >>                 // dimension information for the dataset (among many
> >>other things)
> >>writer.setMetadataRetrieve(MetadataTools.asRetrieve(reader.getMetadataStore()));
> >>                 // initialize the writer
> >>                 writer.setId("/tmp/test.tif");
> >>
> >>
> >>                 int tileWidth = 1024;
> >>                 int tileHeight = 1024;
> >>
> >>                 System.out.println("Series " + reader.getSeriesCount());
> >>                 for (int series = 0; series<
> >>reader.getSeriesCount(); series++) {
> >>                         reader.setSeries(series);
> >>                         writer.setSeries(series);
> >>                         // determine how many tiles are in each
> >>image plane
> >>                         // for simplicity, we'll assume that the
> >>image width and height are multiples of 1024
> >>                         int tileRows = reader.getSizeY() / tileHeight;
> >>                         int tileColumns = reader.getSizeX() / tileWidth;
> >>
> >>                         for (int image = 0; image<
> >>reader.getImageCount(); image++) {
> >>                                         for (int row = 0; row<
> >>tileRows; row++) {
> >>                                                 for (int col = 0;
> >>col<  tileColumns; col++) {
> >>                                                 // open a tile - in
> >>addition to the image index, we need to specify
> >>                                                 // the (x, y)
> >>coordinate of the upper left corner of the tile, along with the
> >>                                                 // width and height
> >>of the tile
> >>                                                 byte[] tile =
> >>reader.openBytes(image, col * tileWidth, row * tileHeight,
> >>tileWidth, tileHeight);
> >>writer.saveBytes(image, tile, col * tileWidth, row * tileHeight,
> >>tileWidth, tileHeight);
> >>                                         }
> >>                                 }
> >>                         }
> >>                 }
> >>
> >>                 reader.close();
> >>                 writer.close();
> >>_______________________________________________
> >>ome-users mailing list
> >>ome-users at lists.openmicroscopy.org.uk
> >>http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users
> 
> _______________________________________________
> ome-users mailing list
> ome-users at lists.openmicroscopy.org.uk
> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users



More information about the ome-users mailing list