-
Notifications
You must be signed in to change notification settings - Fork 62
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
Reading DICOM SR and creation of JSON with its attributes and measurements #110
Conversation
Thank you! I will review tomorrow or weekend. Tomorrow is going to be a bit crazy... |
That's fine. I am going to look into the build errors.... Maybe it makes sense to update the dcmtk |
Yes, definitely makes sense. |
@fedorov Should work now. |
j["codeMeaning"].asCString()); | ||
} | ||
|
||
void addFileToEvidence(DSRDocument &doc, string dirStr, string fileStr){ |
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.
this function is not used - remove?
if (st.gotoNamedChildNode(CODE_DCM_Finding)) { | ||
measurement["Finding"]["CodeMeaning"] = st.getCurrentContentItem().getCodeValue().getCodeMeaning().c_str(); | ||
measurement["Finding"]["CodingSchemeDesignator"] = st.getCurrentContentItem().getCodeValue().getCodingSchemeDesignator().c_str(); | ||
measurement["Finding"]["CodeValue"] = st.getCurrentContentItem().getCodeValue().getCodeValue().c_str(); |
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.
I am shocked you didn't abstract these 3 lines into a function - you are picking bad habits from me!! ;-)
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.
Haha I thought for now (for the RSNA) it's fine.... Refactoring later.... I first want to get everything work....
st.gotoChild(); | ||
|
||
Json::Value measurementItems(Json::arrayValue); | ||
while (st.gotoNext()){ |
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.
Can you test it with this dataset: https://fedorov.gitbooks.io/rsna2016-qirr-dicom4qi/content/instructions/sr-tid1500.html#test-dataset-2
I've just added it to RSNA DICOM4QI. It contains large number of measurement groups and measurements. Should be a good challenge for testing ...
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.
@fedorov How do you want me to test that? Just generating JSON from that DICOM SR (http://slicer.kitware.com/midas3/download/item/262094/Measurements_User2_SemiAuto_Trial2.dcm)?
And how do I know, if it's correct? There is no json to compare it to, right?
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.
Yes, just generate JSON, and then compare it to the output of dsrdump
(or use Atom dicom-dump plugin that exposes dsrdump
).
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.
Yes, that's a good test. Having problems if there is more than 1 MeasurementGroup. Need to check that....
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.
But I know what the problem is. Just need to find out, how to fix that...
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.
Ok I fixed that, but I am not reading rwvm from SR. Should I also implement those things? As well as MeasurementMethod is missing in the json output
cout << "Number of verifying observers: " << doc.getNumberOfVerifyingObservers() << endl; | ||
|
||
OFString observerName, observingDateTime, organizationName; | ||
if (doc.getNumberOfVerifyingObservers() != 0) { |
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.
I did not realize this, but now that I looked - it seems that there are two places where observer is recorded. The one I used for writing TID1500 is TID1001 http://dicom.nema.org/medical/dicom/current/output/chtml/part16/chapter_A.html#sect_TID_1001 Observation context: https://github.com/QIICR/dcmqi/blob/master/apps/sr/tid1500writer.cxx#L78-L84
I agree that in the future we should synchronize this with DCM_Verifying/Verification*
items, but for now I think it will be better if reader is symmetric with the writer.
if (DSRTypes::enumeratedValueToVerificationFlag(metaRoot["VerificationFlag"].asCString()) == | ||
DSRTypes::VF_Verified) { | ||
// TODO: get organization from meta information? | ||
CHECK_COND(doc.verifyDocument(metaRoot["observerContext"]["PersonObserverName"].asCString(), "BWH")); |
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.
let's use QIICR in place of BWH for consistency
segdoc->getSeries().setSeriesDate(contentDate.c_str()); | ||
segdoc->getSeries().setSeriesTime(contentTime.c_str()); | ||
CHECK_COND(segdocDataset.putAndInsertString(DCM_SeriesDate, contentDate.c_str())); | ||
CHECK_COND(segdocDataset.putAndInsertString(DCM_SeriesTime, contentTime.c_str())); |
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.
Did you test with the newest dcmtk - is this still a problem with using getSeries()
?
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.
No I didn't try that, but will check this locally
@che85 this is fine, let's not worry about this in the initial |
…y) from DICOM SR (issue QIICR#88)
…te SR into JSON (issue QIICR#88)
- also added testing
- added roundtrip test for meta information and added ignored keys for those we know are different: - ['activitySession', 'timePoint', 'imageLibrary', 'compositeContext'] - added additional argument for compare for ignoredKeys
@fedorov The job exceeded the maximum time limit for jobs, and has been terminated. |
hm, unpleasant news ... time to package DCMTK and ITK for Mac? |
@fedorov I just restarted the build 😄 |
@che85 is this all set or you are still working on it? |
we have 10 min buffer for now! 50 minutes is the maximum allowed on TravisCI |
Yes should be ready for merge.... |
👍 |
fixes #88
fixes #109
I changed the cli code for jsoncompare in order to add a list of ignored keys from cmake:
['activitySession', 'timePoint', 'imageLibrary', 'compositeContext']