Mercurial > hg > orthanc-stone
changeset 915:912cc77be3b4 am-dev
merge
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Fri, 19 Jul 2019 11:40:45 +0200 |
parents | e4ac54cb8771 (current diff) 4d1f57773b5b (diff) |
children | a911f5bb48da |
files | Applications/Generic/GuiAdapter.cpp |
diffstat | 9 files changed, 52 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/Applications/Generic/GuiAdapter.cpp Thu Jul 18 10:57:59 2019 +0200 +++ b/Applications/Generic/GuiAdapter.cpp Fri Jul 19 11:40:45 2019 +0200 @@ -725,7 +725,7 @@ // SDL ONLY void GuiAdapter::Run() { -#if 0 +#if 1 // TODO: MAKE THIS DYNAMIC !!! See SdlOpenGLViewport vs Cairo in ViewportWrapper # if ORTHANC_ENABLE_OPENGL == 1 && !defined(__APPLE__) glEnable(GL_DEBUG_OUTPUT);
--- a/Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp Thu Jul 18 10:57:59 2019 +0200 +++ b/Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp Fri Jul 19 11:40:45 2019 +0200 @@ -264,7 +264,10 @@ if (quality == BEST_QUALITY) { std::auto_ptr<GetOrthancImageCommand> tmp(new GetOrthancImageCommand); - tmp->SetHttpHeader("Accept-Encoding", "gzip"); + // TODO: review the following comment. Commented out by bgo on 2019-07-19 + // reason: Alain has seen cases where gzipping the uint16 image took 11 sec + // to produce 5mb. The unzipped request was much much faster. + //tmp->SetHttpHeader("Accept-Encoding", "gzip"); tmp->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Pam))); tmp->SetInstanceUri(instance, slice.GetExpectedPixelFormat()); tmp->SetExpectedPixelFormat(slice.GetExpectedPixelFormat()); @@ -273,7 +276,9 @@ else { std::auto_ptr<GetOrthancWebViewerJpegCommand> tmp(new GetOrthancWebViewerJpegCommand); - tmp->SetHttpHeader("Accept-Encoding", "gzip"); + // TODO: review the following comment. Commented out by bgo on 2019-07-19 + // (gzip for jpeg seems overkill) + //tmp->SetHttpHeader("Accept-Encoding", "gzip"); tmp->SetInstance(instance); tmp->SetQuality((quality == 0 ? 50 : 90)); tmp->SetExpectedPixelFormat(slice.GetExpectedPixelFormat());
--- a/Framework/Scene2D/FloatTextureSceneLayer.cpp Thu Jul 18 10:57:59 2019 +0200 +++ b/Framework/Scene2D/FloatTextureSceneLayer.cpp Fri Jul 19 11:40:45 2019 +0200 @@ -93,7 +93,6 @@ IncrementRevision(); } - void FloatTextureSceneLayer::FitRange() { float minValue, maxValue;
--- a/Framework/Scene2D/GrayscaleStyleConfigurator.cpp Thu Jul 18 10:57:59 2019 +0200 +++ b/Framework/Scene2D/GrayscaleStyleConfigurator.cpp Fri Jul 19 11:40:45 2019 +0200 @@ -34,6 +34,19 @@ revision_++; } + void GrayscaleStyleConfigurator::SetCustomWindowing(float windowCenter, float windowWidth) + { + SetWindowing(ImageWindowing_Custom); + customWindowCenter_ = windowCenter; + customWindowWidth_ = windowWidth; + } + + + void GrayscaleStyleConfigurator::SetInverted(bool inverted) + { + inverted_ = inverted; + revision_++; + } void GrayscaleStyleConfigurator::SetLinearInterpolation(bool enabled) { @@ -41,14 +54,12 @@ revision_++; } - TextureBaseSceneLayer* GrayscaleStyleConfigurator::CreateTextureFromImage( const Orthanc::ImageAccessor& image) const { throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); } - TextureBaseSceneLayer* GrayscaleStyleConfigurator::CreateTextureFromDicom( const Orthanc::ImageAccessor& frame, const DicomInstanceParameters& parameters) const @@ -66,7 +77,6 @@ } } - void GrayscaleStyleConfigurator::ApplyStyle(ISceneLayer& layer) const { FloatTextureSceneLayer& l = dynamic_cast<FloatTextureSceneLayer&>(layer); @@ -75,7 +85,15 @@ if (hasWindowing_) { - l.SetWindowing(windowing_); + if (windowing_ != ImageWindowing_Custom) + { + l.SetWindowing(windowing_); + } + else + { + l.SetCustomWindowing(customWindowCenter_, customWindowWidth_); + } } + l.SetInverted(inverted_); } }
--- a/Framework/Scene2D/GrayscaleStyleConfigurator.h Thu Jul 18 10:57:59 2019 +0200 +++ b/Framework/Scene2D/GrayscaleStyleConfigurator.h Fri Jul 19 11:40:45 2019 +0200 @@ -36,19 +36,27 @@ bool linearInterpolation_; bool hasWindowing_; ImageWindowing windowing_; - - // TODO - Add custom windowing + float customWindowWidth_; + float customWindowCenter_; + bool inverted_; public: GrayscaleStyleConfigurator() : revision_(0), linearInterpolation_(false), - hasWindowing_(false) + hasWindowing_(false), + customWindowWidth_(0), + customWindowCenter_(0), + inverted_(false) { } void SetWindowing(ImageWindowing windowing); + void SetCustomWindowing(float windowWidth, float windowCenter); + + void SetInverted(bool inverted); + void SetLinearInterpolation(bool enabled); bool IsLinearInterpolation() const
--- a/Framework/Scene2D/Internals/OpenGLFloatTextureProgram.cpp Thu Jul 18 10:57:59 2019 +0200 +++ b/Framework/Scene2D/Internals/OpenGLFloatTextureProgram.cpp Fri Jul 19 11:40:45 2019 +0200 @@ -33,6 +33,7 @@ "uniform float u_slope; \n" "uniform float u_windowCenter; \n" "uniform float u_windowWidth; \n" + "uniform bool u_invert; \n" "uniform sampler2D u_texture; \n" "varying vec2 v_texcoord; \n" "void main() \n" @@ -50,6 +51,8 @@ " if (v >= 1.0) \n" " v = 1.0; \n" " } \n" + " if (u_invert) \n" + " v = 1.0 - v; \n" " gl_FragColor = vec4(v, v, v, 1); \n" "}"; @@ -133,7 +136,8 @@ void OpenGLFloatTextureProgram::Apply(Data& data, const AffineTransform2D& transform, float windowCenter, - float windowWidth) + float windowWidth, + bool invert) { OpenGLTextureProgram::Execution execution(program_, data.GetTexture(), transform); @@ -141,6 +145,7 @@ glUniform1f(execution.GetUniformLocation("u_offset"), data.GetOffset()); glUniform1f(execution.GetUniformLocation("u_windowCenter"), windowCenter); glUniform1f(execution.GetUniformLocation("u_windowWidth"), windowWidth); + glUniform1f(execution.GetUniformLocation("u_invert"), invert); execution.DrawTriangles(); }
--- a/Framework/Scene2D/Internals/OpenGLFloatTextureProgram.h Thu Jul 18 10:57:59 2019 +0200 +++ b/Framework/Scene2D/Internals/OpenGLFloatTextureProgram.h Fri Jul 19 11:40:45 2019 +0200 @@ -66,7 +66,8 @@ void Apply(Data& data, const AffineTransform2D& transform, float windowCenter, - float windowWidth); + float windowWidth, + bool invert); }; } }
--- a/Framework/Scene2D/Internals/OpenGLFloatTextureRenderer.cpp Thu Jul 18 10:57:59 2019 +0200 +++ b/Framework/Scene2D/Internals/OpenGLFloatTextureRenderer.cpp Fri Jul 19 11:40:45 2019 +0200 @@ -36,6 +36,7 @@ layerTransform_ = layer.GetTransform(); layer.GetWindowing(windowCenter_, windowWidth_); + invert_ = layer.IsInverted(); } @@ -56,7 +57,7 @@ if (texture_.get() != NULL) { program_.Apply(*texture_, AffineTransform2D::Combine(transform, layerTransform_), - windowCenter_, windowWidth_); + windowCenter_, windowWidth_, invert_); } }
--- a/Framework/Scene2D/Internals/OpenGLFloatTextureRenderer.h Thu Jul 18 10:57:59 2019 +0200 +++ b/Framework/Scene2D/Internals/OpenGLFloatTextureRenderer.h Fri Jul 19 11:40:45 2019 +0200 @@ -38,6 +38,7 @@ AffineTransform2D layerTransform_; float windowCenter_; float windowWidth_; + bool invert_; void UpdateInternal(const FloatTextureSceneLayer& layer, bool loadTexture);