comparison Framework/Toolbox/DicomFrameConverter.cpp @ 120:063f7f3d9f14 wasm

fix 3d locations of the doses
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 04 Oct 2017 15:51:34 +0200
parents ba83e38cf3ff
children e2fe9352f240
comparison
equal deleted inserted replaced
119:ba83e38cf3ff 120:063f7f3d9f14
79 // This is for RT-DOSE 79 // This is for RT-DOSE
80 hasRescale_ = true; 80 hasRescale_ = true;
81 isRTDose = true; 81 isRTDose = true;
82 rescaleIntercept_ = 0; 82 rescaleIntercept_ = 0;
83 rescaleSlope_ = doseGridScaling; 83 rescaleSlope_ = doseGridScaling;
84
85 if (!dicom.ParseInteger32(tmp, Orthanc::DICOM_TAG_BITS_STORED))
86 {
87 // Type 1 tag, must be present
88 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat);
89 }
90
91 switch (tmp)
92 {
93 case 16:
94 expectedPixelFormat_ = Orthanc::PixelFormat_Grayscale16;
95 break;
96
97 case 32:
98 expectedPixelFormat_ = Orthanc::PixelFormat_Grayscale32;
99 break;
100
101 default:
102 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
103 }
84 } 104 }
85 105
86 std::string photometric; 106 std::string photometric;
87 if (dicom.CopyToString(photometric, Orthanc::DICOM_TAG_PHOTOMETRIC_INTERPRETATION, false)) 107 if (dicom.CopyToString(photometric, Orthanc::DICOM_TAG_PHOTOMETRIC_INTERPRETATION, false))
88 { 108 {
98 photometric != "MONOCHROME2"); 118 photometric != "MONOCHROME2");
99 119
100 // TODO Add more checks, e.g. on the number of bytes per value 120 // TODO Add more checks, e.g. on the number of bytes per value
101 // (cf. DicomImageInformation.h in Orthanc) 121 // (cf. DicomImageInformation.h in Orthanc)
102 122
103 if (isRTDose) 123 if (!isRTDose)
104 { 124 {
105 expectedPixelFormat_ = Orthanc::PixelFormat_Grayscale32; 125 if (isColor_)
106 } 126 {
107 else if (isColor_) 127 expectedPixelFormat_ = Orthanc::PixelFormat_RGB24;
108 { 128 }
109 expectedPixelFormat_ = Orthanc::PixelFormat_RGB24; 129 else if (isSigned_)
110 } 130 {
111 else if (isSigned_) 131 expectedPixelFormat_ = Orthanc::PixelFormat_SignedGrayscale16;
112 { 132 }
113 expectedPixelFormat_ = Orthanc::PixelFormat_SignedGrayscale16; 133 else
114 } 134 {
115 else 135 expectedPixelFormat_ = Orthanc::PixelFormat_Grayscale16;
116 { 136 }
117 expectedPixelFormat_ = Orthanc::PixelFormat_Grayscale16;
118 } 137 }
119 } 138 }
120 139
121 140
122 void DicomFrameConverter::ConvertFrame(std::auto_ptr<Orthanc::ImageAccessor>& source) const 141 void DicomFrameConverter::ConvertFrame(std::auto_ptr<Orthanc::ImageAccessor>& source) const