comparison Framework/Radiography/RadiographyDicomLayer.cpp @ 432:4eb96c6b4e96 am-vsol-upgrade

improved handling of MONOCHROME1, background and invertion
author am@osimis.io
date Mon, 03 Dec 2018 13:53:29 +0100
parents b85f635f1eb5
children 77e0eb83ff63
comparison
equal deleted inserted replaced
431:26b90b110719 432:4eb96c6b4e96
61 pixelSpacing.size() == 2) 61 pixelSpacing.size() == 2)
62 { 62 {
63 SetPixelSpacing(pixelSpacing[0], pixelSpacing[1]); 63 SetPixelSpacing(pixelSpacing[0], pixelSpacing[1]);
64 } 64 }
65 65
66 //SetPan(-0.5 * GetPixelSpacingX(), -0.5 * GetPixelSpacingY());
67
68 OrthancPlugins::DicomDatasetReader reader(dataset); 66 OrthancPlugins::DicomDatasetReader reader(dataset);
69 67
70 unsigned int width, height; 68 unsigned int width, height;
71 if (!reader.GetUnsignedIntegerValue(width, ConvertTag(Orthanc::DICOM_TAG_COLUMNS)) || 69 if (!reader.GetUnsignedIntegerValue(width, ConvertTag(Orthanc::DICOM_TAG_COLUMNS)) ||
72 !reader.GetUnsignedIntegerValue(height, ConvertTag(Orthanc::DICOM_TAG_ROWS))) 70 !reader.GetUnsignedIntegerValue(height, ConvertTag(Orthanc::DICOM_TAG_ROWS)))
74 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat); 72 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat);
75 } 73 }
76 else 74 else
77 { 75 {
78 SetSize(width, height); 76 SetSize(width, height);
77 }
78
79 if (dataset.GetStringValue(tmp, ConvertTag(Orthanc::DICOM_TAG_PHOTOMETRIC_INTERPRETATION)))
80 {
81 if (tmp == "MONOCHROME1")
82 {
83 SetPreferredPhotomotricDisplayMode(PhotometricDisplayMode_Monochrome1);
84 }
85 else if (tmp == "MONOCHROME2")
86 {
87 SetPreferredPhotomotricDisplayMode(PhotometricDisplayMode_Monochrome2);
88 }
79 } 89 }
80 } 90 }
81 91
82 void RadiographyDicomLayer::SetSourceImage(Orthanc::ImageAccessor* image) // Takes ownership 92 void RadiographyDicomLayer::SetSourceImage(Orthanc::ImageAccessor* image) // Takes ownership
83 { 93 {