dcmqi icon indicating copy to clipboard operation
dcmqi copied to clipboard

Replace CodeSequenceMacro's with #defined constants for standard codes

Open fedorov opened this issue 6 years ago • 7 comments

At the moment, standard codes used require manual typing of the code tuple, such as here. This is error-prone and long. Instead, we should use the #defined constants, as done in dcmsr: https://github.com/commontk/DCMTK/blob/patched-DCMTK-3.6.3_20180205/dcmsr/include/dcmtk/dcmsr/codes/dcm.h#L51.

It would be also interesting to see how we can reuse existing definitions that use DSRCodedEntry:

  • https://github.com/commontk/DCMTK/blob/patched-DCMTK-3.6.3_20180205/dcmsr/include/dcmtk/dcmsr/codes/dcm.h#L1798
  • https://github.com/QIICR/dcmqi/blob/master/libsrc/ParaMapConverter.cpp#L191

fedorov avatar Apr 05 '18 14:04 fedorov

This might look easy at first glance but would probably require various (partly non-trivial) changes to the underlying DCMTK because of the existing hierarchy of DCMTK modules and the fact that both DSRCodedEntryValue and the code definitions are currently defined in module "dcmsr". As far as I can remember, @michaelonken and I talked about this some time ago (when he introduced the CodeSequenceMacro class). Maybe, we should resume the discussion...

jriesmeier avatar Apr 13 '18 16:04 jriesmeier

There go my hopes of a "good first issue"! Nothing's easy...

fedorov avatar Apr 13 '18 18:04 fedorov

Background of the decision not to use use DSRCodedEnryValue was since then I had to link against dcmsr. Since I am going over the dcmiod API anyway it is a good moment to discuss the possibility to use the same class in both places. Maybe I can only link in the object for DSRCodedEntryValue instead of the whole dcmsr library or find another way to refactor the existing code. I will talk to @jriesmeier and let you know, @fedorov. This will take some days though (next week there is Connectathon in the Netherlands).

michaelonken avatar Apr 15 '18 15:04 michaelonken

If only support for the pre-defined codes from DCMR (PS3.16) is needed, class DSRBasicCodedEntry would be sufficient. I would also like to avoid any additional dependencies for module "dcmsr". As mentioned before, we will talk about this soon...

jriesmeier avatar Apr 15 '18 18:04 jriesmeier

Since dcmqi already depends both on dcmsr and dcmiod, maybe it is most expedient to solve it in dcmqi with a #defined macro that converts between the two? Something like this:

#define dsrbce2csm(csm) \ 
   CodeSequenceMacro(csm.GetCodeValue(), \
   csm.GetCodingSchemeDesignator(), csm.GetCodeMeaning())

...

CodeSequenceMacro myCSMcode = dsrbce2csm(CODE_DCM_LesionIdentifier)

fedorov avatar Apr 15 '18 19:04 fedorov

@fedorov This would probably be the easiest way (for now). Instead of calling the methods GetCodeValue(), GetCodingSchemeDesignator(), etc. you can simply access the (constant) members of DSRBasicCodedEntry directly (CodeValue, CodingSchemeDesignator, CodingSchemeVersion, CodeMeaning).

jriesmeier avatar Apr 15 '18 19:04 jriesmeier

Thanks @jriesmeier! This means I can label it "good first issue" again! :-D

fedorov avatar Apr 15 '18 19:04 fedorov