Skip to content

Commit

Permalink
ENH: Don't check functional groups (speedup)
Browse files Browse the repository at this point in the history
Speedup writing of DICOM segmentation and parametric map objects
by disabling functional group checking when writing.
  • Loading branch information
michaelonken committed Nov 1, 2023
1 parent 697ff25 commit c9d56cb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libsrc/ImageSEGConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,10 @@ namespace dcmqi {
CHECK_COND(segdoc->getFrameOfReference().setFrameOfReferenceUID(frameOfRefUIDchar));
}

// Don't check functional groups since its very time consuming and we trust
// ourselves to put together valid datasets
segdoc->setCheckFGOnWrite(OFFalse);

OFCondition writeResult = segdoc->writeDataset(segdocDataset);
if(writeResult.bad()){
cerr << "FATAL ERROR: Writing of the SEG dataset failed!";
Expand Down Expand Up @@ -482,7 +486,7 @@ namespace dcmqi {

pair <map<unsigned,ShortImageType::Pointer>, string> ImageSEGConverter::dcmSegmentation2itkimage(DcmDataset *segDataset) {
DcmSegmentation *segdoc = NULL;

DcmRLEDecoderRegistration::registerCodecs();

OFCondition cond = DcmSegmentation::loadDataset(*segDataset, segdoc);
Expand Down
4 changes: 4 additions & 0 deletions libsrc/ParaMapConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,10 @@ namespace dcmqi {
pMapDoc->getSeries().setSeriesNumber(metaInfo.getSeriesNumber().c_str());

DcmDataset* output = new DcmDataset();

// Don't check functional groups since its very time consuming and we trust
// ourselves to put together valid datasets
pMapDoc->getFunctionalGroups().setCheckOnWrite(OFFalse);
CHECK_COND(pMapDoc->writeDataset(*output));
return output;
}
Expand Down

0 comments on commit c9d56cb

Please sign in to comment.