GoogleCloudPlatform / wsi-to-dicom-converter

Conversion tool/library for converting whole slide images to DICOM
Apache License 2.0
77 stars 26 forks source link

DCM output images showing up black on some levels #94

Closed ericbuehl closed 2 years ago

ericbuehl commented 2 years ago
  1. Using code from develop (282325)
  2. Building and running within a vanilla ubuntu docker image
  3. All dependency installed and built via ./cloud_build/ubuntuBuild.sh
  4. Using CMU-2.svs as input data
  5. example command: wsi2dcm --input CMU-2.svs --outFolder cmuout/ --startOn 4 --levels 8 --debug output:
[2022-03-14 18:46:57.164381] [0x0000004008394340] [info]    dicomization is started
[2022-03-14 18:46:57.165676] [0x0000004008394340] [warning] threads parameter is less than 1, consuming all avalible threads
[2022-03-14 18:46:57.165774] [0x0000004008394340] [warning] batch parameter is not set, batch is unlimited
[2022-03-14 18:46:57.501650] [0x0000004008394340] [debug]    
[2022-03-14 18:46:57.502081] [0x0000004008394340] [debug]   Level Count: 4
[2022-03-14 18:46:57.503398] [0x0000004008394340] [debug]   Uncropped dimensions Level[4]: 4876, 1903
[2022-03-14 18:46:57.503484] [0x0000004008394340] [debug]   Set Smallest
[2022-03-14 18:46:57.503726] [0x0000004008394340] [debug]   Level[4] frames:10, 4
[2022-03-14 18:46:57.503796] [0x0000004008394340] [debug]   Uncropped dimensions Level[5]: 2438, 951
[2022-03-14 18:46:57.503885] [0x0000004008394340] [debug]   Set Smallest
[2022-03-14 18:46:57.503945] [0x0000004008394340] [debug]   Level[5] frames:5, 2
[2022-03-14 18:46:57.504365] [0x0000004008394340] [debug]   Uncropped dimensions Level[6]: 1219, 475
[2022-03-14 18:46:57.504399] [0x0000004008394340] [debug]   Set Smallest
[2022-03-14 18:46:57.504474] [0x0000004008394340] [debug]   Level[6] frames:3, 1
[2022-03-14 18:46:57.504633] [0x0000004008394340] [debug]   Uncropped dimensions Level[7]: 609, 237
[2022-03-14 18:46:57.504653] [0x0000004008394340] [debug]   Set Smallest
[2022-03-14 18:46:57.504721] [0x0000004008394340] [debug]   Level[7] frames:2, 1
[2022-03-14 18:46:57.504774] [0x0000004008394340] [debug]   Uncropped dimensions Level[8]: 304, 118
[2022-03-14 18:46:57.504827] [0x0000004008394340] [debug]   Set Smallest
[2022-03-14 18:46:57.504998] [0x0000004008394340] [debug]   Level[8] frames:1, 1
[2022-03-14 18:46:57.791183] [0x0000004008394340] [debug]    
[2022-03-14 18:46:57.791307] [0x0000004008394340] [debug]   Starting Level 4
[2022-03-14 18:46:57.791860] [0x0000004008394340] [debug]   level size: 4875 1903 16.0037
[2022-03-14 18:46:57.791957] [0x0000004008394340] [debug]   multiplicator: 16.0037
[2022-03-14 18:46:57.792029] [0x0000004008394340] [debug]   levelToGet: 2
[2022-03-14 18:46:57.792097] [0x0000004008394340] [debug]   downsample: 16
[2022-03-14 18:46:57.792173] [0x0000004008394340] [debug]   downsampleOfLevel: 0.99977
[2022-03-14 18:46:57.792245] [0x0000004008394340] [debug]   frameDownsampled: 499, 499
[2022-03-14 18:46:57.792384] [0x0000004008394340] [debug]   higherMagnifcationDicomFiles 0
[2022-03-14 18:46:57.793147] [0x0000004008394340] [debug]   Level Frame Count: 40
[2022-03-14 18:46:58.430072] [0x00000040094b1700] [debug]    frame size: 11kb
[2022-03-14 18:46:58.448414] [0x0000004008cb0700] [debug]    frame size: 16kb
[2022-03-14 18:46:58.826128] [0x000000400acb4700] [debug]    frame size: 4kb
[2022-03-14 18:46:58.873890] [0x000000400bcb6700] [debug]    frame size: 4kb
[2022-03-14 18:46:58.915102] [0x000000400b4b5700] [debug]    frame size: 4kb
[2022-03-14 18:46:58.923300] [0x0000004009cb2700] [debug]    frame size: 4kb
[2022-03-14 18:46:58.930410] [0x000000400c4b7700] [debug]    frame size: 4kb
[2022-03-14 18:46:59.058290] [0x000000400a4b3700] [debug]    frame size: 4kb
[2022-03-14 18:46:59.332207] [0x00000040094b1700] [debug]    frame size: 4kb
[2022-03-14 18:46:59.504926] [0x0000004008cb0700] [debug]    frame size: 4kb
[2022-03-14 18:46:59.635306] [0x000000400acb4700] [debug]    frame size: 7kb
[2022-03-14 18:46:59.869747] [0x000000400b4b5700] [debug]    frame size: 71kb
[2022-03-14 18:46:59.915873] [0x000000400bcb6700] [debug]    frame size: 70kb
[2022-03-14 18:46:59.951229] [0x0000004009cb2700] [debug]    frame size: 51kb
[2022-03-14 18:47:00.057248] [0x000000400c4b7700] [debug]    frame size: 5kb
[2022-03-14 18:47:00.156447] [0x000000400a4b3700] [debug]    frame size: 5kb
[2022-03-14 18:47:00.353829] [0x00000040094b1700] [debug]    frame size: 66kb
[2022-03-14 18:47:00.541982] [0x000000400acb4700] [debug]    frame size: 55kb
[2022-03-14 18:47:00.605109] [0x0000004008cb0700] [debug]    frame size: 73kb
[2022-03-14 18:47:00.900731] [0x000000400b4b5700] [debug]    frame size: 9kb
[2022-03-14 18:47:00.903478] [0x000000400bcb6700] [debug]    frame size: 7kb
[2022-03-14 18:47:01.020370] [0x0000004009cb2700] [debug]    frame size: 73kb
[2022-03-14 18:47:01.081352] [0x000000400a4b3700] [debug]    frame size: 49kb
[2022-03-14 18:47:01.235981] [0x000000400c4b7700] [debug]    frame size: 83kb
[2022-03-14 18:47:01.278671] [0x00000040094b1700] [debug]    frame size: 5kb
[2022-03-14 18:47:01.528315] [0x000000400acb4700] [debug]    frame size: 5kb
[2022-03-14 18:47:01.788026] [0x0000004008cb0700] [debug]    frame size: 51kb
[2022-03-14 18:47:02.098192] [0x000000400b4b5700] [debug]    frame size: 84kb
[2022-03-14 18:47:02.100359] [0x000000400bcb6700] [debug]    frame size: 88kb
[2022-03-14 18:47:02.206806] [0x000000400a4b3700] [debug]    frame size: 7kb
[2022-03-14 18:47:02.272262] [0x0000004009cb2700] [debug]    frame size: 14kb
[2022-03-14 18:47:02.314133] [0x00000040094b1700] [debug]    frame size: 10kb
[2022-03-14 18:47:02.542332] [0x000000400c4b7700] [debug]    frame size: 10kb
[2022-03-14 18:47:02.651156] [0x000000400acb4700] [debug]    frame size: 5kb
[2022-03-14 18:47:02.776733] [0x0000004008cb0700] [debug]    frame size: 5kb
[2022-03-14 18:47:02.999762] [0x000000400bcb6700] [debug]    frame size: 16kb
[2022-03-14 18:47:03.022870] [0x000000400b4b5700] [debug]    frame size: 5kb
[2022-03-14 18:47:03.082044] [0x0000004009cb2700] [debug]    frame size: 20kb
[2022-03-14 18:47:03.090988] [0x000000400a4b3700] [debug]    frame size: 40kb
[2022-03-14 18:47:03.142935] [0x00000040094b1700] [debug]    frame size: 6kb
[2022-03-14 18:47:03.572745] [0x0000004008394340] [debug]    
[2022-03-14 18:47:03.572991] [0x0000004008394340] [debug]   Starting Level 5
[2022-03-14 18:47:03.573448] [0x0000004008394340] [debug]   level size: 2437 951 32.0191
[2022-03-14 18:47:03.573786] [0x0000004008394340] [debug]   multiplicator: 32.0191
[2022-03-14 18:47:03.573875] [0x0000004008394340] [debug]   levelToGet: 3
[2022-03-14 18:47:03.573953] [0x0000004008394340] [debug]   downsample: 32
[2022-03-14 18:47:03.574027] [0x0000004008394340] [debug]   downsampleOfLevel: 0.999405
[2022-03-14 18:47:03.574149] [0x0000004008394340] [debug]   frameDownsampled: 499, 499
[2022-03-14 18:47:03.574300] [0x0000004008394340] [debug]   higherMagnifcationDicomFiles 0
[2022-03-14 18:47:03.574698] [0x0000004008394340] [debug]   Level Frame Count: 10
[2022-03-14 18:47:04.099722] [0x0000004008cb0700] [debug]    frame size: 40kb
[2022-03-14 18:47:04.224257] [0x000000404ede4700] [debug]    frame size: 24kb
[2022-03-14 18:47:04.246746] [0x000000404e5e3700] [debug]    frame size: 6kb
[2022-03-14 18:47:04.590061] [0x000000400a4b3700] [debug]    frame size: 7kb
[2022-03-14 18:47:04.601154] [0x0000004009cb2700] [debug]    frame size: 4kb
[2022-03-14 18:47:04.620269] [0x00000040094b1700] [debug]    frame size: 4kb
[2022-03-14 18:47:04.642179] [0x000000404f5e5700] [debug]    frame size: 6kb
[2022-03-14 18:47:04.673208] [0x000000404dde2700] [debug]    frame size: 36kb
[2022-03-14 18:47:04.875972] [0x0000004008cb0700] [debug]    frame size: 46kb
[2022-03-14 18:47:04.931069] [0x000000404ede4700] [debug]    frame size: 33kb
[2022-03-14 18:47:05.315167] [0x0000004008394340] [debug]    
[2022-03-14 18:47:05.315233] [0x0000004008394340] [debug]   Starting Level 6
[2022-03-14 18:47:05.315273] [0x0000004008394340] [debug]   level size: 2437 951 32.0191
[2022-03-14 18:47:05.315301] [0x0000004008394340] [debug]   multiplicator: 32.0191
[2022-03-14 18:47:05.315320] [0x0000004008394340] [debug]   levelToGet: 3
[2022-03-14 18:47:05.315337] [0x0000004008394340] [debug]   downsample: 64
[2022-03-14 18:47:05.315359] [0x0000004008394340] [debug]   downsampleOfLevel: 1.99881
[2022-03-14 18:47:05.315379] [0x0000004008394340] [debug]   frameDownsampled: 999, 951
[2022-03-14 18:47:05.315398] [0x0000004008394340] [debug]   higherMagnifcationDicomFiles 0
[2022-03-14 18:47:05.315432] [0x0000004008394340] [debug]   Level Frame Count: 3
[2022-03-14 18:47:06.244938] [0x000000400a4b3700] [debug]    frame size: 32kb
[2022-03-14 18:47:06.252177] [0x00000040094b1700] [debug]    frame size: 47kb
[2022-03-14 18:47:06.477401] [0x00000040505e7700] [debug]    frame size: 4kb
[2022-03-14 18:47:06.828315] [0x0000004008394340] [debug]    
[2022-03-14 18:47:06.828386] [0x0000004008394340] [debug]   Starting Level 7
[2022-03-14 18:47:06.828429] [0x0000004008394340] [debug]   level size: 2437 951 32.0191
[2022-03-14 18:47:06.828468] [0x0000004008394340] [debug]   multiplicator: 32.0191
[2022-03-14 18:47:06.828615] [0x0000004008394340] [debug]   levelToGet: 3
[2022-03-14 18:47:06.828704] [0x0000004008394340] [debug]   downsample: 128
[2022-03-14 18:47:06.828744] [0x0000004008394340] [debug]   downsampleOfLevel: 3.99762
[2022-03-14 18:47:06.828768] [0x0000004008394340] [debug]   frameDownsampled: 1998, 951
[2022-03-14 18:47:06.828801] [0x0000004008394340] [debug]   higherMagnifcationDicomFiles 0
[2022-03-14 18:47:06.828845] [0x0000004008394340] [debug]   Level Frame Count: 2
[2022-03-14 18:47:07.908224] [0x000000400a4b3700] [debug]    frame size: 2kb
[2022-03-14 18:47:08.392908] [0x00000040533aa700] [debug]    frame size: 23kb
[2022-03-14 18:47:08.787137] [0x0000004008394340] [debug]    
[2022-03-14 18:47:08.787239] [0x0000004008394340] [debug]   Starting Level 8
[2022-03-14 18:47:08.787302] [0x0000004008394340] [debug]   level size: 2437 951 32.0191
[2022-03-14 18:47:08.787341] [0x0000004008394340] [debug]   multiplicator: 32.0191
[2022-03-14 18:47:08.787367] [0x0000004008394340] [debug]   levelToGet: 3
[2022-03-14 18:47:08.787390] [0x0000004008394340] [debug]   downsample: 256
[2022-03-14 18:47:08.787426] [0x0000004008394340] [debug]   downsampleOfLevel: 7.99524
[2022-03-14 18:47:08.787457] [0x0000004008394340] [debug]   frameDownsampled: 2437, 951
[2022-03-14 18:47:08.787479] [0x0000004008394340] [debug]   higherMagnifcationDicomFiles 0
[2022-03-14 18:47:08.787720] [0x0000004008394340] [debug]   Level Frame Count: 1
[2022-03-14 18:47:10.571696] [0x00000040588b1700] [debug]    frame size: 8kb
[2022-03-14 18:47:10.645810] [0x0000004008394340] [info]    dicomization is done

I initially loaded these into GCP's DICOM web store and noticed that the OHIF viewer was showing some images as empty. I confirmed the similar odd behavior locally with QuPath. Note the black/corrupt previews in QuPath:

image

Let me know if there is any other information I can provide

ericbuehl commented 2 years ago

This issue seems to be mitigated using the --floorCorrectOpenslideLevelDownsamples option