dcmqi
dcmqi copied to clipboard
Replace CodeSequenceMacro's with #defined constants for standard codes
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 #define
d 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
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...
There go my hopes of a "good first issue"! Nothing's easy...
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).
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...
Since dcmqi already depends both on dcmsr
and dcmiod
, maybe it is most expedient to solve it in dcmqi with a #define
d 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 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).
Thanks @jriesmeier! This means I can label it "good first issue" again! :-D