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

ENH: revise initialization of TrackingUID #365

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions libsrc/ImageSEGConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,36 @@ namespace dcmqi {
if(segmentAttributes->getSegmentDescription().length() > 0)
segment->setSegmentDescription(segmentAttributes->getSegmentDescription().c_str());

if(segmentAttributes->getTrackingIdentifier().length() > 0)
if(segmentAttributes->getTrackingIdentifier().length() > 0){
std::string trackingUID;
if(!segmentAttributes->getTrackingUniqueIdentifier().length()){
std::cout << "WARNING: TrackingIdentifier is initialized, but TrackingUniqueIdentifier is not!" << std::endl;
std::cout << "TrackingUniqueIdentifier will be automatically populated. If you are encoding longitudinally" << std::endl;
std::cout << "segmented data, make sure you use the same TrackingUniqueIdentifier for the same structure!" << std::endl;

char dimUID[128];
dcmGenerateUniqueIdentifier(dimUID, QIICR_UID_ROOT);
trackingUID = std::string(dimUID);
} else {
trackingUID = segmentAttributes->getTrackingUniqueIdentifier();
}
segment->setTrackingID(segmentAttributes->getTrackingIdentifier().c_str());
segment->setTrackingUID(trackingUID.c_str());
}

if(segmentAttributes->getTrackingUniqueIdentifier().length() > 0){
std::string trackingID;
if(!segmentAttributes->getTrackingUniqueIdentifier().length()){
std::cout << "WARNING: TrackingUniqueIdentifier is initialized, but TrackingIdentifier is not!" << std::endl;
std::cout << "TrackingIdentifier will be automatically populated to be the same as SegmentLabel." << std::endl;

if(segmentAttributes->getTrackingUniqueIdentifier().length() > 0)
trackingID = segmentLabel.c_str();
} else {
trackingID = segmentAttributes->getTrackingIdentifier();
}
segment->setTrackingID(trackingID.c_str());
segment->setTrackingUID(segmentAttributes->getTrackingUniqueIdentifier().c_str());
}

CodeSequenceMacro* typeModifierCode = segmentAttributes->getSegmentedPropertyTypeModifierCodeSequence();
if (typeModifierCode != NULL) {
Expand Down