How to twitch python-bioformats code so that it will show all dimensions like Openslide do?

Hi there,
Is there any way to load all image dimensions like openslide shows?
When I load .ndpi with an Openslide it shows nine image dimensions but when I load the same image with python-bioformats it just shows 5 dimensions randomly.
For example:

As u can see in that screenshot, where I have loaded the input image with Openslide package and It shows all image level_dimensions, but when I try to load this same image with bioformats it just load (1, 4, 16, 64, 256) downsamples or it only shows even dimensions, not odd dimensions.
How can I solve it? so that I can extract all dimensions using bioformats :slightly_smiling_face:

Hi @dmc-8288, if you donwload the Bio-Formats command line tools from https://www.openmicroscopy.org/bio-formats/downloads/ and run the following command, what ouput do you get? Does it match the same missing dimesnions?

showinf -nopix path/to/myFile.ndpi

Hello there,
Thanks for your reply.
I run the command which you have posted above but the printed result is still the same.

Series count = 7

Series #0 :

Image count = 11

RGB = true (3)

Interleaved = true

Indexed = false (true color)

Width = 186496

Height = 36608

SizeZ = 11

SizeT = 1

SizeC = 3 (effectively 1)

Thumbnail size = 128 x 25

Endianness = intel (little)

Dimension order = XYCZT (uncertain)

Pixel type = uint8

Valid bits per pixel = 8

Metadata complete = true

Thumbnail series = false


Plane #0 <=> Z 0, C 0, T 0

Plane #3 <=> Z 3, C 0, T 0

Plane #4 <=> Z 4, C 0, T 0

Plane #5 <=> Z 5, C 0, T 0

Plane #6 <=> Z 6, C 0, T 0

Plane #7 <=> Z 7, C 0, T 0

Plane #10 <=> Z 10, C 0, T 0

Series #1 :

Image count = 11

RGB = true (3)

Interleaved = true

Indexed = false (true color)

Width = 46624

Height = 9152

SizeZ = 11

SizeT = 1

SizeC = 3 (effectively 1)

Thumbnail size = 128 x 25

Endianness = intel (little)

Dimension order = XYCZT (uncertain)

Pixel type = uint8

Valid bits per pixel = 8

Metadata complete = true

Thumbnail series = true


Plane #0 <=> Z 0, C 0, T 0

Plane #3 <=> Z 3, C 0, T 0

Plane #4 <=> Z 4, C 0, T 0

Plane #5 <=> Z 5, C 0, T 0

Plane #6 <=> Z 6, C 0, T 0

Plane #7 <=> Z 7, C 0, T 0

Plane #10 <=> Z 10, C 0, T 0

Series #2 :

Image count = 11

RGB = true (3)

Interleaved = true

Indexed = false (true color)

Width = 11656

Height = 2288

SizeZ = 11

SizeT = 1

SizeC = 3 (effectively 1)

Thumbnail size = 128 x 25

Endianness = intel (little)

Dimension order = XYCZT (uncertain)

Pixel type = uint8

Valid bits per pixel = 8

Metadata complete = true

Thumbnail series = true


Plane #0 <=> Z 0, C 0, T 0

Plane #3 <=> Z 3, C 0, T 0

Plane #4 <=> Z 4, C 0, T 0

Plane #5 <=> Z 5, C 0, T 0

Plane #6 <=> Z 6, C 0, T 0

Plane #7 <=> Z 7, C 0, T 0

Plane #10 <=> Z 10, C 0, T 0

Series #3 :

Image count = 11

RGB = true (3)

Interleaved = false

Indexed = false (true color)

Width = 2914

Height = 572

SizeZ = 11

SizeT = 1

SizeC = 3 (effectively 1)

Thumbnail size = 128 x 25

Endianness = intel (little)

Dimension order = XYCZT (uncertain)

Pixel type = uint8

Valid bits per pixel = 8

Metadata complete = true

Thumbnail series = true


Plane #0 <=> Z 0, C 0, T 0

Plane #3 <=> Z 3, C 0, T 0

Plane #4 <=> Z 4, C 0, T 0

Plane #5 <=> Z 5, C 0, T 0

Plane #6 <=> Z 6, C 0, T 0

Plane #7 <=> Z 7, C 0, T 0

Plane #10 <=> Z 10, C 0, T 0

Series #4 :

Image count = 11

RGB = true (3)

Interleaved = false

Indexed = false (true color)

Width = 728

Height = 143

SizeZ = 11

SizeT = 1

SizeC = 3 (effectively 1)

Thumbnail size = 128 x 25

Endianness = intel (little)

Dimension order = XYCZT (uncertain)

Pixel type = uint8

Valid bits per pixel = 8

Metadata complete = true

Thumbnail series = true


Plane #0 <=> Z 0, C 0, T 0

Plane #3 <=> Z 3, C 0, T 0

Plane #4 <=> Z 4, C 0, T 0

Plane #5 <=> Z 5, C 0, T 0

Plane #6 <=> Z 6, C 0, T 0

Plane #7 <=> Z 7, C 0, T 0

Plane #10 <=> Z 10, C 0, T 0

Series #5 :

Image count = 1

RGB = true (3)

Interleaved = false

Indexed = false (true color)

Width = 1188

Height = 407

SizeZ = 1

SizeT = 1

SizeC = 3 (effectively 1)

Thumbnail size = 128 x 43

Endianness = intel (little)

Dimension order = XYCZT (uncertain)

Pixel type = uint8

Valid bits per pixel = 8

Metadata complete = true

Thumbnail series = true


Plane #0 <=> Z 0, C 0, T 0

Series #6 :

Image count = 1

RGB = false (1)

Interleaved = false

Indexed = false (true color)

Width = 594

Height = 203

SizeZ = 1

SizeT = 1

SizeC = 1

Thumbnail size = 128 x 43

Endianness = intel (little)

Dimension order = XYCZT (uncertain)

Pixel type = uint8

Valid bits per pixel = 8

Metadata complete = true

Thumbnail series = true


Plane #0 <=> Z 0, C 0, T 0

Reading global metadata

AHEX[0]: 78242443CD0870292444C9057020283FC9036C192036C9106C1A1C35C10868141431C1116029143FC00558270845BC04581A0833BD0760191038BD055C2F0C4BBC085C1E1440BD0664161439C10264141436C40164191C3FC00768142438C505F908

AHEX[0].fluorescence: 000700000023000300000027010B0000002B01170000001B010F0000001F011B00000017010F0000003301130000002F01230000001F012300000023010F0000002F012700000023012B00000023012F00000027012B0000002F01270000002711FC

AHEX[0].ploidy: 7C21183FB1097823183FB10778191C3FB103740F1C2FB10F74131433A907700F0C2FA90F6C1F103BA809681F043FA807680F042FA907700B0C33A9036C210C47A80B7011103FAD03740B1833B00074071433B003740B1C3BAC0B78072437B0002232

AHEX[1]: 80273041D105782B3045CD0178203042CC02741A2C36CD0C741E2837C50370172032C90D68282040C40964281444C007601C1434C50668181C37C503642E184CC00A681F2042C5036C1A243AC8016C182037C804701B2840C40A701A303CC9019724

AHEX[1].fluorescence: 000000000027000000000027010F0000002B011B0000001B011300000023011F0000001701130000003301170000002F012B0000001F01270000002301170000002F012B0000001F012F00000023013700000027012F0000002F0127000000271236

AHEX[1].ploidy: 8423243FB90580272443B903801B283FB8007C13282FB90D7C172037B1037811182FB10B74211C3FB00B701F1043AC0970131033AD03780F1837B00074231447B00D78131C3FB0007C0F2037B4037C0B1C37B407800F283BB40B800B3037B403BF73

AHEX[2]: 7C21183FB1097823183FB10778191C3FB103740F1C2FB10F74131433A907700F0C2FA90F6C1F103BA809681F043FA807680F042FA907700B0C33A9036C210C47A80B7011103FAD03740B1833B00074071433B003740B1C3BAC0B78072437B0002232

AHEX[2].fluorescence: 7C21183FB1097823183FB10778191C3FB103740F1C2FB10F74131433A907700F0C2FA90F6C1F103BA809681F043FA807680F042FA907700B0C33A9036C210C47A80B7011103FAD03740B1833B00074071433B003740B1C3BAC0B78072437B0002232

AHEX[2].ploidy: 7C21183FB1097823183FB10778191C3FB103740F1C2FB10F74131433A907700F0C2FA90F6C1F103BA809681F043FA807680F042FA907700B0C33A9036C210C47A80B7011103FAD03740B1833B00074071433B003740B1C3BAC0B78072437B0002232

BitsPerSample: 8

Compression: JPEG

Created: 2011/09/08

DateTime: 2019:11:21 13:13:51

ImageLength: 36608

ImageWidth: 186496

Instrument Make: Hamamatsu

Instrument Model: C9600-12

MHLN[0].24bit: _1357CJIPRKOXUjx

MHLN[0].36bit: _1357GGEPRKOXUjx

MHLN[1].24bit: _1357FHHPRKOXUjx

MHLN[1].36bit: _1359CKJPRKOXUjx

MHLN[2].24bit: _1357CJIPRKOXUjx

MHLN[2].36bit: _1357DEEPRKOXUjx

Macro.S/N: 990414

MetaDataPhotometricInterpretation: RGB

NDP.S/N: 990294

NumberOfChannels: 3

Objective.Lens.Magnificant: 35.16

PSHV: 182

PSHV.10x: 170

PSHV.40x: 182

PSHV.ploidy: 200

PSHV.ploidy.10x: 140

PhotometricInterpretation: YCbCr

Product: C9600-12

ReferenceBlackWhite: 0

ResolutionUnit: Centimeter

SamplesPerPixel: 3

Software: NDP.scan 2.5.89

Updated: 2019/10/04

XResolution: 44000.0

YCbCrSubSampling: chroma image dimensions = luma image dimensions

YRNP[0]: 0,0,0,0

YRNP[1]: 0,0,0,0

YRNP[2]: 0,0,0,0

YResolution: 43946.0

calibration.version: 249

ccd.height: 0

ccd.width: 9309

ccd.width.ploidy: 9302

coarse.focus.pitch: 4870

colorfilterID: 1

cube.kind: 0

exposure.barcode.macro: 331

exposure.slide.darkfield.macro: 10

exposure.slide.macro: 22

fine.focus.pitch: 250

focalplane.leftbottom: 87407,687713,105379

focalplane.lefttop: 87407,487713,104760

focalplane.rightbottom: 487407,687713,106435

focalplane.righttop: 487407,487713,105803

lane.shift.amount: -11

roi.barcode.macro: 913,258,1178,625

roi.slide.macro: 24,239,1212,646

slant.leftbottom: 89267,688443,105780

slant.lefttop: 89267,488443,105321

slant.rightbottom: 489267,488443,106276

slant.righttop: 489267,688443,106740

slide.tickness: 0

stage.center: 177407,587713

system.version: 1.0

target.white.intensity: 235

valid.DDKP: 1

valid.DLTP: 0

valid.DSHP: 1

variable.exposuretime: 0

zCoarse[0]: 1,7392,0,100

zCoarse[1]: 1,1946,0,100

zCoarse[2]: 0,0,0,0

zFine[0]: 1,295680,0,100

zFine[1]: 1,77824,0,100

zFine[2]: 0,0,0,0

Reading series #0 metadata

It just shows the dimensions of odd ones, not an even one.
Can you explain to me why it is behaving like that? :slightly_smiling_face:

Yeah, that does seem odd. The last 2 series (1188x407 and 594x203) also don’t seem to be part of the openslide data, are these an expected series? It also looks like some of the Z planes are missing, is that to be expected?

If you are able to upload the file to https://www.openmicroscopy.org/qa2/qa/upload/ I would be happy to take a more detailed look.

Those extra dimensions

Yeah, you are right, even openslide doesn’t show last 2 series (1188x407 and 594x203) and these last two are macroscopic and map (so it doesn’t matter in my case whether these are shown or not) I just want to extract all dimensions as shown in Openslide, I can run it for the first stack but as you know openslide doesn’t work for a second focal-length, that’s why I want to use python-bioformats to extract every series with their 11 stacks.
The think the link which you have shared with me only allows to upload if ur data is 2Gb but in my case itś around 4.8 GB. I will share you a link of the data so that u can download it and try to see the problem.

It seems like I don’t have the right permissions to access that link. If needs be you can send me a PM here with an email address and I can arrange ftp details for transferring the file.

Following up on this, I’ve had a chance to dig through the provided sample file. From the looks of it the file contains 57 planes in total, which are (5 resolutions x 11 z planes) + macroscopic + map. The resolutions present are:

Image Width: 186496 Image Length: 36608
Image Width: 46624 Image Length: 9152
Image Width: 11656 Image Length: 2288
Image Width: 2914 Image Length: 572
Image Width: 728 Image Length: 143

So by the looks of it openslide may be trying to fill in the missing resolutions by downsampling the original. Do all of the resolutions open and display correctly with Openslide ok?

Thank you for the reply,
I agree with you that the openslide is downsampling the original image to fulfil the missing resolution or we can say it’s applying downsampling to the original image so that difference between two series images is not high while visualizing them in the web-wsi-pyramid-viewer.

Yeah, every resolution open and display correctly with openslide.

Does there any way to downsample or resize the original image in the order of Openslide.level_dimension?

Linking to the ongoing related GitHub Issue for others following the thread: https://github.com/ome/bioformats/issues/3641