Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image-sets-normalization pipeline #1086

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

PaulHax
Copy link
Collaborator

@PaulHax PaulHax commented Mar 5, 2024

Prior art:

Image sets JSON shape:
https://docs.aws.amazon.com/healthimaging/latest/devguide/understanding-image-sets.html

TODO


  • Fix exception related tag memory management with the set.
  • Support proviing just binary file headers and add test
  • Optimize: Only read tags once.
  • Delete gdcmDiscriminateVolume.h if still unused (may be helpful for instance sorting step)

Current output with 2 image series/sets:
actual.json.tar.gz

@thewtex
Copy link
Member

thewtex commented Mar 5, 2024

Notes:

  • We do not want to read from directories
  • We want to take as inputs the dicom file headers, itk::wasm::BinaryFile or itk::wasm::BinaryStream
  • In the C++ tests, these will be the full dicom binary files
  • In JavaScript tests, these can just be the binary file headers, code snippet from @floryst 👍
 function* parseDicomUpToPixelData() {
  const reader = new StreamingByteReader();

  // preamble
  yield* reader.seek(128);

  // prefix
  const prefix = yield* reader.readAscii(4);
  if (prefix !== "DICM") {
    throw new Error("Not DICOM");
  }

  const info = yield* readFieldMetaInfo(reader);
  const explicitVr = info.transferSyntaxUid !== ImplicitTransferSyntaxUID;
  const littleEndian = info.transferSyntaxUid !== ExplicitVRBigEndianUID;

  yield* skipDataElementsUntil(
    reader,
    // (7fe0,0010): Pixel Data
    (group, element) => group === 0x7fe0 && element === 0x0010,
    { explicitVr, littleEndian }
  );
}

@PaulHax PaulHax changed the title sort-dicom-series pipeline image-sets-normalization pipeline Mar 18, 2024
@PaulHax PaulHax force-pushed the dicom-sort branch 3 times, most recently from 4837dd0 to 0775d5b Compare March 19, 2024 13:30
packages/dicom/gdcm/discriminate-volume.cxx Outdated Show resolved Hide resolved
packages/dicom/gdcm/discriminate-volume.cxx Outdated Show resolved Hide resolved
packages/dicom/gdcm/image-sets-normalization.cxx Outdated Show resolved Hide resolved
packages/dicom/gdcm/image-sets-normalization.cxx Outdated Show resolved Hide resolved
@PaulHax PaulHax force-pushed the dicom-sort branch 7 times, most recently from 66c9a9f to 1eb7705 Compare March 22, 2024 17:21
@PaulHax
Copy link
Collaborator Author

PaulHax commented Mar 26, 2024

current JSON output
image-sets.json

AWS Image Set example
image-sets.json

@PaulHax PaulHax force-pushed the dicom-sort branch 2 times, most recently from b8e4822 to df876af Compare April 1, 2024 12:22
Also, remove import of "itkGDCMImageIO.h" by extracting CharStringToUTF8Converter
@thewtex
Copy link
Member

thewtex commented Aug 13, 2024

Rebase started in #1197

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants