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

Reading DICOM SR and creation of JSON with its attributes and measurements #110

Merged
merged 12 commits into from
Nov 8, 2016

Conversation

che85
Copy link
Member

@che85 che85 commented Nov 4, 2016

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']

@fedorov
Copy link
Member

fedorov commented Nov 4, 2016

Thank you! I will review tomorrow or weekend. Tomorrow is going to be a bit crazy...

@che85
Copy link
Member Author

che85 commented Nov 4, 2016

That's fine. I am going to look into the build errors.... Maybe it makes sense to update the dcmtk

@fedorov
Copy link
Member

fedorov commented Nov 4, 2016

Yes, definitely makes sense.

@che85
Copy link
Member Author

che85 commented Nov 4, 2016

@fedorov Should work now.

j["codeMeaning"].asCString());
}

void addFileToEvidence(DSRDocument &doc, string dirStr, string fileStr){
Copy link
Member

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();
Copy link
Member

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!! ;-)

Copy link
Member Author

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()){
Copy link
Member

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 ...

Copy link
Member Author

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?

Copy link
Member

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).

Copy link
Member Author

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....

Copy link
Member Author

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...

Copy link
Member Author

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) {
Copy link
Member

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"));
Copy link
Member

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()));
Copy link
Member

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()?

Copy link
Member Author

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

@jcfr jcfr mentioned this pull request Nov 4, 2016
@fedorov
Copy link
Member

fedorov commented Nov 4, 2016

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

@che85 this is fine, let's not worry about this in the initial
implementation.

@che85
Copy link
Member Author

che85 commented Nov 7, 2016

@fedorov The job exceeded the maximum time limit for jobs, and has been terminated.

@fedorov
Copy link
Member

fedorov commented Nov 7, 2016

hm, unpleasant news ... time to package DCMTK and ITK for Mac?

@che85
Copy link
Member Author

che85 commented Nov 8, 2016

@fedorov I just restarted the build 😄

@fedorov
Copy link
Member

fedorov commented Nov 8, 2016

@che85 is this all set or you are still working on it?

@fedorov
Copy link
Member

fedorov commented Nov 8, 2016

I just restarted the build 😄

we have 10 min buffer for now! 50 minutes is the maximum allowed on TravisCI

@che85
Copy link
Member Author

che85 commented Nov 8, 2016

Yes should be ready for merge....

@fedorov
Copy link
Member

fedorov commented Nov 8, 2016

👍

@fedorov fedorov merged commit 9022e5a into QIICR:master Nov 8, 2016
@che85 che85 deleted the TID15002JSON branch November 18, 2016 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants