Mercurial > hg > orthanc-stone
comparison Framework/Radiography/RadiographyScene.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 | 26b90b110719 |
children | 04711a2e12cd |
comparison
equal
deleted
inserted
replaced
431:26b90b110719 | 432:4eb96c6b4e96 |
---|---|
164 assert(it->second != NULL); | 164 assert(it->second != NULL); |
165 delete it->second; | 165 delete it->second; |
166 } | 166 } |
167 } | 167 } |
168 | 168 |
169 PhotometricDisplayMode RadiographyScene::GetPreferredPhotomotricDisplayMode() const | |
170 { | |
171 // return the mode of the first layer who "cares" about its display mode (normaly, the one and only layer that is a DicomLayer) | |
172 for (Layers::const_iterator it = layers_.begin(); it != layers_.end(); it++) | |
173 { | |
174 if (it->second->GetPreferredPhotomotricDisplayMode() != PhotometricDisplayMode_Default) | |
175 { | |
176 return it->second->GetPreferredPhotomotricDisplayMode(); | |
177 } | |
178 } | |
179 | |
180 return PhotometricDisplayMode_Default; | |
181 } | |
182 | |
183 | |
169 void RadiographyScene::GetLayersIndexes(std::vector<size_t>& output) const | 184 void RadiographyScene::GetLayersIndexes(std::vector<size_t>& output) const |
170 { | 185 { |
171 for (Layers::const_iterator it = layers_.begin(); it != layers_.end(); it++) | 186 for (Layers::const_iterator it = layers_.begin(); it != layers_.end(); it++) |
172 { | 187 { |
173 output.push_back(it->first); | 188 output.push_back(it->first); |
421 | 436 |
422 void RadiographyScene::Render(Orthanc::ImageAccessor& buffer, | 437 void RadiographyScene::Render(Orthanc::ImageAccessor& buffer, |
423 const AffineTransform2D& viewTransform, | 438 const AffineTransform2D& viewTransform, |
424 ImageInterpolation interpolation) const | 439 ImageInterpolation interpolation) const |
425 { | 440 { |
426 Orthanc::ImageProcessing::Set(buffer, 0); | |
427 | |
428 // Render layers in the background-to-foreground order | 441 // Render layers in the background-to-foreground order |
429 for (size_t index = 0; index < countLayers_; index++) | 442 for (size_t index = 0; index < countLayers_; index++) |
430 { | 443 { |
431 Layers::const_iterator it = layers_.find(index); | 444 Layers::const_iterator it = layers_.find(index); |
432 if (it != layers_.end()) | 445 if (it != layers_.end()) |
569 | 582 |
570 AffineTransform2D view = AffineTransform2D::Combine( | 583 AffineTransform2D view = AffineTransform2D::Combine( |
571 AffineTransform2D::CreateScaling(1.0 / pixelSpacingX, 1.0 / pixelSpacingY), | 584 AffineTransform2D::CreateScaling(1.0 / pixelSpacingX, 1.0 / pixelSpacingY), |
572 AffineTransform2D::CreateOffset(-extent.GetX1(), -extent.GetY1())); | 585 AffineTransform2D::CreateOffset(-extent.GetX1(), -extent.GetY1())); |
573 | 586 |
587 // wipe background before rendering | |
588 Orthanc::ImageProcessing::Set(layers, 0); | |
589 | |
574 Render(layers, view, interpolation); | 590 Render(layers, view, interpolation); |
575 | 591 |
576 Orthanc::Image rendered(Orthanc::PixelFormat_Grayscale16, | 592 Orthanc::Image rendered(Orthanc::PixelFormat_Grayscale16, |
577 layers.GetWidth(), layers.GetHeight(), false); | 593 layers.GetWidth(), layers.GetHeight(), false); |
578 Orthanc::ImageProcessing::Convert(rendered, layers); | 594 Orthanc::ImageProcessing::Convert(rendered, layers); |