Mercurial > hg > orthanc-stone
comparison Framework/Scene2D/GrayscaleStyleConfigurator.cpp @ 835:0965b665c653
windowing and linear interpolation in GrayscaleStyleConfigurator
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 31 May 2019 16:30:32 +0200 |
parents | aead999345e0 |
children | e62e7361fd60 |
comparison
equal
deleted
inserted
replaced
834:c51b12fb4f34 | 835:0965b665c653 |
---|---|
19 **/ | 19 **/ |
20 | 20 |
21 | 21 |
22 #include "GrayscaleStyleConfigurator.h" | 22 #include "GrayscaleStyleConfigurator.h" |
23 | 23 |
24 #include "FloatTextureSceneLayer.h" | |
25 | |
24 #include <Core/OrthancException.h> | 26 #include <Core/OrthancException.h> |
25 | 27 |
26 namespace OrthancStone | 28 namespace OrthancStone |
27 { | 29 { |
28 TextureBaseSceneLayer* GrayscaleStyleConfigurator::CreateTextureFromImage(const Orthanc::ImageAccessor& image) const | 30 void GrayscaleStyleConfigurator::SetLinearInterpolation(bool enabled) |
31 { | |
32 linearInterpolation_ = enabled; | |
33 revision_++; | |
34 } | |
35 | |
36 TextureBaseSceneLayer* GrayscaleStyleConfigurator::CreateTextureFromImage( | |
37 const Orthanc::ImageAccessor& image) const | |
29 { | 38 { |
30 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); | 39 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); |
31 } | 40 } |
41 | |
42 TextureBaseSceneLayer* GrayscaleStyleConfigurator::CreateTextureFromDicom( | |
43 const Orthanc::ImageAccessor& frame, | |
44 const DicomInstanceParameters& parameters) const | |
45 { | |
46 std::auto_ptr<TextureBaseSceneLayer> layer(parameters.CreateTexture(frame)); | |
47 | |
48 if (layer.get() == NULL || | |
49 layer->GetTexture().GetFormat() != Orthanc::PixelFormat_Float32) | |
50 { | |
51 throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageFormat); | |
52 } | |
53 else | |
54 { | |
55 return layer.release(); | |
56 } | |
57 } | |
58 | |
59 | |
60 void GrayscaleStyleConfigurator::ApplyStyle(ISceneLayer& layer) const | |
61 { | |
62 FloatTextureSceneLayer& l = dynamic_cast<FloatTextureSceneLayer&>(layer); | |
63 | |
64 l.SetLinearInterpolation(linearInterpolation_); | |
65 | |
66 if (hasWindowing_) | |
67 { | |
68 l.SetWindowing(windowing_); | |
69 } | |
70 } | |
32 } | 71 } |