Skip to content

Commit

Permalink
ENH: add PixelType = short restriction to Itk2DicomConverter::itkimag…
Browse files Browse the repository at this point in the history
…e2dcmSegmentation

Tempalted function Itk2DicomConverter::itkimage2dcmSegmentation should
not be instantiated with PixelType other than short. This is because
we do not handle any other pixel type for writing DICOM segmentation
object.

Any attempt to instantiate should result in a compile time error,
warning the developer about the limitation.
  • Loading branch information
jadh4v committed Aug 21, 2024
1 parent 3d6401c commit 664467e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/dcmqi/Itk2DicomConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ namespace dcmqi {
* added in the SharedFunctionalGroupsSequence without any geometry checks.
* @return A pointer to the resulting DICOM Segmentation object.
*/
template<class ImageSourceType>
template<class ImageSourceType, std::enable_if_t<std::is_same_v<short, typename ImageSourceType::PixelType>, bool> = 0>
static DcmDataset* itkimage2dcmSegmentation(vector<DcmDataset*> dcmDatasets,
vector<itk::SmartPointer<const ImageSourceType>> segmentations,
const string &metaData,
Expand Down
2 changes: 1 addition & 1 deletion libsrc/Itk2DicomConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace dcmqi {

// -------------------------------------------------------------------------------------

template<class ImageSourceType>
template<class ImageSourceType, std::enable_if_t<std::is_same_v<short, typename ImageSourceType::PixelType>, bool>>
DcmDataset* Itk2DicomConverter::itkimage2dcmSegmentation(vector<DcmDataset*> dcmDatasets,
vector<itk::SmartPointer<const ImageSourceType>> segmentations,
const string &metaData,
Expand Down

0 comments on commit 664467e

Please sign in to comment.