-
Notifications
You must be signed in to change notification settings - Fork 53
Read dicom tags #406
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
Read dicom tags #406
Conversation
FYI @agirault |
Can you add usage documentation @floryst ? or an example? |
901bb63
to
3d3df6b
Compare
I'm not sure why I can't request reviewers, so here: @thewtex @agirault. This is still in a rough shape, so apart from a code review there are a few questions/remarks remaining:
|
src/readDICOMTags.js
Outdated
|
||
const readDICOMTags = async ( | ||
fileList, | ||
tags = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These parameters may change, pending API discussions.
- fileList: probably going to become a single file rather than a list of files
- tags: if we want a null/undefined
tags
arg to mean "give me all tags", then this will stay. Right now there is no logic for getting all tags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for the single file. Specification of the tags-per-file is simpler this way, too. +1 for the current null
returns all tags API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@floryst awesome!! 🚀 👨🎤
Additionally, appropriate character set conversion is performed, decoding encoded strings into UTF-8.
This is fantastic! Can we add a test to ensure its functionality?
I'm not sure why I can't request reviewers, so here: @thewtex @agirault.
@floryst after accepting the invitation to the repository (just sent), you should be able to request reviewers.
I think the API would make more sense if we simply read the tags from a single file instead
+1
Would it make sense to support returning all tags, rather than specifying which ones the user wants? If so, I think setting tags=null|undefined can mean "return all tags".
+1
I haven't tested private tags. What would the expected behavior be for private tags, since we don't necessarily know the tag's VR? (This is partially a GDCM question.)
In the future, if this is possible and needed, we could add a third argument, privateTags=false
.
Code style: is there an automatic c++ style enforcer for itk-js? My c++ code currently has a mix of the itk-js c++ coding style and the clang c++ codingstyle and I wanted to ask before making manual changes to match the itk-js c++ coding style.
Thanks for asking! The code is looking very clean, btw. We should use the ITK clang-format style. To apply it to the current code, download the clang-format-8 executable, and run it on the source code files with the ITK/.clang-format configuration file.
We gave a pre-commit hooks setup for ITK that runs clang-format -- we could add this to itk.js sometime.
libiconv: if the docker container installed the requisite compilation headers for iconv (which might be provided by libc6 rather than a dedicated package), then I wouldn't need to add iconv as an external project. As it stands, the ExternalProject is the only way to use iconv, which is why I include it.
This is awesome. While we could add the package to the docker image, I think the ExternalProject is better because we can change the base image Linux distribution and Linux distribution version, and not have to worry about losing the required headers or them moving around. We can also independently update the libiconv version.
@@ -3,6 +3,14 @@ find_path(RapidJSON_INCLUDE_DIR | |||
) | |||
include_directories(${RapidJSON_INCLUDE_DIR}) | |||
|
|||
# include iconv for reading dicom tags | |||
include(ExternalProject) | |||
set(Iconv iconv) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lovely!
src/readDICOMTags.js
Outdated
return { tags: tagResults, webWorker: worker } | ||
} | ||
const numberOfWorkers = navigator.hardwareConcurrency ? navigator.hardwareConcurrency : 4 | ||
const workerPool = new WorkerPool(numberOfWorkers, workerFunction) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want this to defined outside function scope so to re-use across multiple runs.
src/readDICOMTags.js
Outdated
|
||
const readDICOMTags = async ( | ||
fileList, | ||
tags = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for the single file. Specification of the tags-per-file is simpler this way, too. +1 for the current null
returns all tags API.
Good timing, I was just starting to rewrite this PR to read in a single file instead of a list. I'll push that out shortly, after some build resolutions. |
Adds the node.js API for reading dicom tags from files.
96ce2ba
to
c215ea5
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@floryst beautiful!
This adds an API for reading DICOM tags from DICOM object files. Additionally, appropriate character set conversion is performed, decoding encoded strings into UTF-8.
Relevant issue: #394
Todo: