comparison Framework/Radiography/RadiographyScene.cpp @ 860:238693c3bc51 am-dev

merge default -> am-dev
author Alain Mazy <alain@mazy.be>
date Mon, 24 Jun 2019 14:35:00 +0200
parents be9c1530d40a
children 580dd82e13f5
comparison
equal deleted inserted replaced
856:a6e17a5a39e7 860:238693c3bc51
23 23
24 #include "RadiographyAlphaLayer.h" 24 #include "RadiographyAlphaLayer.h"
25 #include "RadiographyDicomLayer.h" 25 #include "RadiographyDicomLayer.h"
26 #include "RadiographyTextLayer.h" 26 #include "RadiographyTextLayer.h"
27 #include "RadiographyMaskLayer.h" 27 #include "RadiographyMaskLayer.h"
28 #include "../Toolbox/DicomFrameConverter.h" 28 #include "../Deprecated/Toolbox/DicomFrameConverter.h"
29 29
30 #include <Core/Images/Image.h> 30 #include <Core/Images/Image.h>
31 #include <Core/Images/ImageProcessing.h> 31 #include <Core/Images/ImageProcessing.h>
32 #include <Core/Images/PamReader.h> 32 #include <Core/Images/PamReader.h>
33 #include <Core/Images/PamWriter.h> 33 #include <Core/Images/PamWriter.h>
170 assert(it->second != NULL); 170 assert(it->second != NULL);
171 delete it->second; 171 delete it->second;
172 } 172 }
173 } 173 }
174 174
175 PhotometricDisplayMode RadiographyScene::GetPreferredPhotomotricDisplayMode() const 175 RadiographyPhotometricDisplayMode RadiographyScene::GetPreferredPhotomotricDisplayMode() const
176 { 176 {
177 // return the mode of the first layer who "cares" about its display mode (normaly, the one and only layer that is a DicomLayer) 177 // return the mode of the first layer who "cares" about its display mode (normaly, the one and only layer that is a DicomLayer)
178 for (Layers::const_iterator it = layers_.begin(); it != layers_.end(); it++) 178 for (Layers::const_iterator it = layers_.begin(); it != layers_.end(); it++)
179 { 179 {
180 if (it->second->GetPreferredPhotomotricDisplayMode() != PhotometricDisplayMode_Default) 180 if (it->second->GetPreferredPhotomotricDisplayMode() != RadiographyPhotometricDisplayMode_Default)
181 { 181 {
182 return it->second->GetPreferredPhotomotricDisplayMode(); 182 return it->second->GetPreferredPhotomotricDisplayMode();
183 } 183 }
184 } 184 }
185 185
186 return PhotometricDisplayMode_Default; 186 return RadiographyPhotometricDisplayMode_Default;
187 } 187 }
188 188
189 189
190 void RadiographyScene::GetLayersIndexes(std::vector<size_t>& output) const 190 void RadiographyScene::GetLayersIndexes(std::vector<size_t>& output) const
191 { 191 {
343 343
344 RadiographyLayer& RadiographyScene::LoadDicomImage(Orthanc::ImageAccessor* dicomImage, // takes ownership 344 RadiographyLayer& RadiographyScene::LoadDicomImage(Orthanc::ImageAccessor* dicomImage, // takes ownership
345 const std::string& instance, 345 const std::string& instance,
346 unsigned int frame, 346 unsigned int frame,
347 Deprecated::DicomFrameConverter* converter, // takes ownership 347 Deprecated::DicomFrameConverter* converter, // takes ownership
348 PhotometricDisplayMode preferredPhotometricDisplayMode, 348 RadiographyPhotometricDisplayMode preferredPhotometricDisplayMode,
349 RadiographyLayer::Geometry* geometry) 349 RadiographyLayer::Geometry* geometry)
350 { 350 {
351 RadiographyDicomLayer& layer = dynamic_cast<RadiographyDicomLayer&>(RegisterLayer(new RadiographyDicomLayer(IObservable::GetBroker(), *this))); 351 RadiographyDicomLayer& layer = dynamic_cast<RadiographyDicomLayer&>(RegisterLayer(new RadiographyDicomLayer(IObservable::GetBroker(), *this)));
352 352
353 layer.SetInstance(instance, frame); 353 layer.SetInstance(instance, frame);
640 640
641 std::auto_ptr<Orthanc::Image> rendered(ExportToImage(pixelSpacingX, pixelSpacingY, interpolation)); // note: we don't invert the image in the pixels data because we'll set the PhotometricDisplayMode correctly in the DICOM tags 641 std::auto_ptr<Orthanc::Image> rendered(ExportToImage(pixelSpacingX, pixelSpacingY, interpolation)); // note: we don't invert the image in the pixels data because we'll set the PhotometricDisplayMode correctly in the DICOM tags
642 642
643 createDicomRequestContent["Tags"] = dicomTags; 643 createDicomRequestContent["Tags"] = dicomTags;
644 644
645 PhotometricDisplayMode photometricMode = GetPreferredPhotomotricDisplayMode(); 645 RadiographyPhotometricDisplayMode photometricMode = GetPreferredPhotomotricDisplayMode();
646 if ((invert && photometricMode != PhotometricDisplayMode_Monochrome2) || 646 if ((invert && photometricMode != RadiographyPhotometricDisplayMode_Monochrome2) ||
647 (!invert && photometricMode == PhotometricDisplayMode_Monochrome1)) 647 (!invert && photometricMode == RadiographyPhotometricDisplayMode_Monochrome1))
648 { 648 {
649 createDicomRequestContent["Tags"]["PhotometricInterpretation"] = "MONOCHROME1"; 649 createDicomRequestContent["Tags"]["PhotometricInterpretation"] = "MONOCHROME1";
650 } 650 }
651 else 651 else
652 { 652 {