choosehappy / HistoQC

HistoQC is an open-source quality control tool for digital pathology slides
BSD 3-Clause Clear License
253 stars 100 forks source link

<class 'TypeError'> Inappropriate argument type. __init__() should return None, not 'int' #304

Open csittz opened 1 month ago

csittz commented 1 month ago

Hi i downloaded ovarian cancer tissue svs files from public imaging portal and try to run histoqc python3 -m histoqc -c first *.svs

but i encounter this error

2024-06-03 14:46:39,094 - ERROR - XX.svs: Has unknown or uncalculated base magnification, cannot specify magnification scale! Did you try getMag?
2024-06-03 14:46:39,095 - ERROR - XX.svs - Error analyzing file (skipping):      <class 'TypeError'> Inappropriate argument type. __init__() should return None, not 'int'

any idea what is wrong and how to work around it?

jacksonjacobs1 commented 4 weeks ago

Hi @csittz,

Thank you for reaching out! This error message is quite common and usually means an image file (usually .tif or .tiff but potentially also .svs) you are using does not contain key metadata.

Can you run tifftools dump <your-image-filepath> and paste it into this thread? tifftools can be installed with pip.

csittz commented 4 weeks ago

Thanks for your help. here's the tifftools dump output for one of the svs file.

Header: 0x4949 <little-endian> <ClassicTIFF>
Directory 0: offset 1632748420 (0x6151c384)
  NewSubfileType 254 (0xFE) LONG: 0
  ImageWidth 256 (0x100) SHORT: 55776
  ImageLength 257 (0x101) SHORT: 44390
  BitsPerSample 258 (0x102) SHORT: <3> 8 8 8
  Compression 259 (0x103) SHORT: 7 (JPEG 7 (0x7))
  Photometric 262 (0x106) SHORT: 2 (RGB 2 (0x2))
  ImageDescription 270 (0x10E) ASCII:
  SamplesPerPixel 277 (0x115) SHORT: 3
  PlanarConfig 284 (0x11C) SHORT: 1 (Chunky 1 (0x1))
  TileWidth 322 (0x142) SHORT: 240
  TileLength 323 (0x143) SHORT: 240
  TileOffsets 324 (0x144) LONG: <43105> 16 618720 1217723 1787803 2379501 3017643 3696718 5267520 8480459 12321670 16792658 21986177 27694392 33785911 39917332 46281676 52436451 58681098 65522289 72494063 ...
  TileByteCounts 325 (0x145) LONG: <43105> 7830 7276 6220 6661 7299 6608 6975 7042 6581 6918 6437 6603 8897 7467 7356 7613 7406 7323 6725 6176 ...
  JPEGTables 347 (0x15B) UNDEFINED: <574> b'\xff\xd8\xff\xdb\x00C\x00\x06\x04\x05\x06\x05\x04\x06\x06\x05\x06\x07\x07\x06' ... (estimated quality: 80)
  YCbCrSubsampling 530 (0x212) SHORT: <2> 2 2
  ImageDepth 32997 (0x80E5) LONG: 1
  ICCProfile 34675 (0x8773) UNDEFINED: <1687824> b'\x00\x19\xc1\x10SICC\x04\x00\x00\x00scnrRGB ' ...
Directory 1: offset 1635150692 (0x61766b64)
  NewSubfileType 254 (0xFE) LONG: 0
  ImageWidth 256 (0x100) SHORT: 964
  ImageLength 257 (0x101) SHORT: 768
  BitsPerSample 258 (0x102) SHORT: <3> 8 8 8
  Compression 259 (0x103) SHORT: 7 (JPEG 7 (0x7))
  Photometric 262 (0x106) SHORT: 2 (RGB 2 (0x2))
  ImageDescription 270 (0x10E) ASCII:
  StripOffsets 273 (0x111) LONG: <48> 1634782444 1634789563 1634797090 1634805388 1634813969 1634822840 1634831845 1634840851 1634849645 1634857910 1634865848 1634874485 1634883434 1634892259 1634901226 1634910366 1634919462 1634928287 1634937525 1634946178 ...
  SamplesPerPixel 277 (0x115) SHORT: 3
  RowsPerStrip 278 (0x116) SHORT: 16
  StripByteCounts 279 (0x117) LONG: <48> 7119 7527 8298 8581 8871 9005 9006 8794 8265 7938 8637 8949 8825 8967 9140 9096 8825 9238 8653 8289 ...
  PlanarConfig 284 (0x11C) SHORT: 1 (Chunky 1 (0x1))
  JPEGTables 347 (0x15B) UNDEFINED: <289> b'\xff\xd8\xff\xdb\x00C\x00\n\x07\x07\x08\x07\x06\n\x08\x08\x08\x0b\n\n' ... (estimated quality: 70)
  YCbCrSubsampling 530 (0x212) SHORT: <2> 2 2
  ImageDepth 32997 (0x80E5) LONG: 1
Directory 2: offset 1824388758 (0x6cbdf696)
  NewSubfileType 254 (0xFE) LONG: 0
  ImageWidth 256 (0x100) SHORT: 13944
  ImageLength 257 (0x101) SHORT: 11097
  BitsPerSample 258 (0x102) SHORT: <3> 8 8 8
  Compression 259 (0x103) SHORT: 7 (JPEG 7 (0x7))
  Photometric 262 (0x106) SHORT: 2 (RGB 2 (0x2))
  ImageDescription 270 (0x10E) ASCII: Aperio Image Library v12.0.15
56896x44490 [0,100 55776x44390] (240x240) -> 13944x11097 JPEG/RGB Q=90
  SamplesPerPixel 277 (0x115) SHORT: 3
  PlanarConfig 284 (0x11C) SHORT: 1 (Chunky 1 (0x1))
  TileWidth 322 (0x142) SHORT: 240
  TileLength 323 (0x143) SHORT: 240
  TileOffsets 324 (0x144) LONG: <2773> 1635152095 1635157168 1635162285 1635166986 1635172441 1635202298 1635245907 1635255519 1635260143 1635265475 1635279386 1635332942 1635396740 1635469496 1635513700 1635534331 1635583469 1635648927 1635713375 1635764314 ...
  TileByteCounts 325 (0x145) LONG: <2773> 5073 5117 4701 5455 29857 43609 9612 4624 5332 13911 53556 63798 72756 44204 20631 49138 65458 64448 50939 43980 ...
  JPEGTables 347 (0x15B) UNDEFINED: <574> b'\xff\xd8\xff\xdb\x00C\x00\x03\x02\x02\x03\x02\x02\x03\x03\x03\x03\x04\x03\x03' ... (estimated quality: 90)
  YCbCrSubsampling 530 (0x212) SHORT: <2> 2 2
  ImageDepth 32997 (0x80E5) LONG: 1
Directory 3: offset 1839677964 (0x6da7420c)
  NewSubfileType 254 (0xFE) LONG: 0
  ImageWidth 256 (0x100) SHORT: 3486
  ImageLength 257 (0x101) SHORT: 2774
  BitsPerSample 258 (0x102) SHORT: <3> 8 8 8
  Compression 259 (0x103) SHORT: 7 (JPEG 7 (0x7))
  Photometric 262 (0x106) SHORT: 2 (RGB 2 (0x2))
  ImageDescription 270 (0x10E) ASCII: Aperio Image Library v12.0.15
56896x44490 [0,100 55776x44390] (240x240) -> 3486x2774 JPEG/RGB Q=95
  SamplesPerPixel 277 (0x115) SHORT: 3
  PlanarConfig 284 (0x11C) SHORT: 1 (Chunky 1 (0x1))
  TileWidth 322 (0x142) SHORT: 240
  TileLength 323 (0x143) SHORT: 240
  TileOffsets 324 (0x144) LONG: <180> 1824411824 1824438385 1824528753 1824620812 1824720922 1824821844 1824928333 1825030531 1825128877 1825219971 1825314952 1825400379 1825488168 1825561623 1825589824 1825626718 1825677975 1825787997 1825893985 1825998468 ...
  TileByteCounts 325 (0x145) LONG: <180> 26561 90368 92059 100110 100922 106489 102198 98346 91094 94981 85427 87789 73455 28201 36894 51257 110022 105988 104483 102681 ...
  JPEGTables 347 (0x15B) UNDEFINED: <574> b'\xff\xd8\xff\xdb\x00C\x00\x02\x01\x01\x01\x01\x01\x02\x01\x01\x01\x02\x02\x02' ... (estimated quality: 95)
  YCbCrSubsampling 530 (0x212) SHORT: <2> 2 2
  ImageDepth 32997 (0x80E5) LONG: 1
Directory 4: offset 1840303924 (0x6db0cf34)
  NewSubfileType 254 (0xFE) LONG: 9 (ReducedImage 1 (0x1), Macro 8 (0x8))
  ImageWidth 256 (0x100) SHORT: 1600
  ImageLength 257 (0x101) SHORT: 652
  BitsPerSample 258 (0x102) SHORT: <3> 8 8 8
  Compression 259 (0x103) SHORT: 7 (JPEG 7 (0x7))
  Photometric 262 (0x106) SHORT: 2 (RGB 2 (0x2))
  ImageDescription 270 (0x10E) ASCII: Aperio Image Library v12.0.15
macro 1600x652
  StripOffsets 273 (0x111) LONG: <41> 1840113604 1840124406 1840131681 1840136564 1840141357 1840146552 1840151491 1840156221 1840160475 1840164812 1840169214 1840173800 1840178995 1840183631 1840188329 1840192928 1840197094 1840201267 1840205668 1840209991 ...
  SamplesPerPixel 277 (0x115) SHORT: 3
  RowsPerStrip 278 (0x116) SHORT: 16
  StripByteCounts 279 (0x117) LONG: <41> 10802 7275 4883 4793 5195 4939 4730 4254 4337 4402 4586 5195 4636 4698 4599 4166 4173 4401 4323 4267 ...
  PlanarConfig 284 (0x11C) SHORT: 1 (Chunky 1 (0x1))
  JPEGTables 347 (0x15B) UNDEFINED: <289> b'\xff\xd8\xff\xdb\x00C\x00\x10\x0b\x0c\x0e\x0c\n\x10\x0e\r\x0e\x12\x11\x10' ... (estimated quality: 50)
  YCbCrSubsampling 530 (0x212) SHORT: <2> 2 2
  ImageDepth 32997 (0x80E5) LONG: 1