pevers / gdcm-rs

GDCM bindings for Rust
8 stars 6 forks source link

Limiting the number of cores for pixel data decoding #15

Open Enet4 opened 3 months ago

Enet4 commented 3 months ago

Just relaying the information from https://github.com/Enet4/dicom-rs/issues/551, as this seems to be mostly an issue with the use of gdcm-rs. Is there a way to limit the number of cores in use for decoding?

I have noticed an issue/bug specifically when using the gdcm feature and decompressing pixel data with JPEG 2000. Specifically, the decompression process utilizes all system cores available (no matter what I do) while decompressing. It is particularly noticeable with large multiframe dicoms (mammo DBT).

image

As far as I can tell, it doesn't occur with any other encapsulated pixel data decompression from GDCM, and this is probably an upstream issue with GDCM itself. Using openjpeg-sys instead seems to be the solution :)

PRadeckiDH commented 2 months ago

@Enet4 Thanks for reposting the issue here!

@pevers I see reference to it here in the GDCM repo, where it defaults to all system cores detected.

https://github.com/malaterre/GDCM/blob/5819053476f1efe8a5e92c66a91bdaf6e1356436/Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx#L480

JPEG2000Codec::JPEG2000Codec()
{
  Internals = new JPEG2000Internals;
  SetNumberOfThreadsForDecompression( -1 );
}