Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Antoine Belvire
otb
Commits
8402ca80
Commit
8402ca80
authored
16 years ago
by
Julien Michel
Browse files
Options
Downloads
Patches
Plain Diff
BUG: (Visu Refactoring) Avoid to intensively recompute normalization factors
parent
2b5d3b8c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Code/VisuRefac/otbImageLayer.txx
+38
-24
38 additions, 24 deletions
Code/VisuRefac/otbImageLayer.txx
with
38 additions
and
24 deletions
Code/VisuRefac/otbImageLayer.txx
+
38
−
24
View file @
8402ca80
...
...
@@ -19,6 +19,7 @@
#define __otbImageLayer_txx
#include "itkImageRegionConstIterator.h"
#include "otbMacro.h"
namespace otb
{
...
...
@@ -26,7 +27,7 @@ namespace otb
template <class TImage, class TOutputImage>
ImageLayer<TImage,TOutputImage>
::ImageLayer() : m_Quicklook(), m_Image(), m_Histogram(), m_RenderingFunction(),
m_NumberOfHistogramBins(2
55
), m_AutoMinMax(true), m_AutoMinMaxUpToDate(false), m_AutoMinMaxQuantile(0.02),
m_NumberOfHistogramBins(2
0
), m_AutoMinMax(true), m_AutoMinMaxUpToDate(false), m_AutoMinMaxQuantile(0.02),
m_QuicklookRenderingFilter(), m_ExtractRenderingFilter(), m_ScaledExtractRenderingFilter(),
m_ExtractFilter(), m_ScaledExtractFilter()
{
...
...
@@ -90,12 +91,14 @@ ImageLayer<TImage,TOutputImage>
// Render quicklook
if(this->GetHasQuicklook())
{
otbMsgDevMacro(<<"ImageLayer::RenderImages(): Regenerating quicklook");
m_QuicklookRenderingFilter->Update();
this->SetRenderedQuicklook(m_QuicklookRenderingFilter->GetOutput());
}
// If there are pixels to render
if(this->GetExtractRegion().GetNumberOfPixels() > 0)
{
otbMsgDevMacro(<<"ImageLayer::RenderImages(): Regenerating extract");
m_ExtractRenderingFilter->GetOutput()->SetRequestedRegion(this->GetExtractRegion());
m_ExtractRenderingFilter->Update();
this->SetRenderedExtract(m_ExtractRenderingFilter->GetOutput());
...
...
@@ -108,6 +111,7 @@ ImageLayer<TImage,TOutputImage>
// If there are pixels to render
if(this->GetScaledExtractRegion().GetNumberOfPixels() > 0)
{
otbMsgDevMacro(<<"ImageLayer::RenderImages(): Regenerating scaled extract");
m_ScaledExtractRenderingFilter->GetOutput()->SetRequestedRegion(this->GetScaledExtractRegion());
m_ScaledExtractRenderingFilter->Update();
this->SetRenderedScaledExtract(m_ScaledExtractRenderingFilter->GetOutput());
...
...
@@ -141,6 +145,7 @@ ImageLayer<TImage,TOutputImage>
// Check if we need to generate the histogram again
if( !m_Histogram || (histogramSource->GetUpdateMTime() < histogramSource->GetPipelineMTime()) )
{
otbMsgDevMacro(<<"ImageLayer::RenderHistogram(): Regenerating histogram due to pippeline update.");
m_AutoMinMaxUpToDate = false;
// Update the histogram source
...
...
@@ -162,6 +167,8 @@ ImageLayer<TImage,TOutputImage>
listSample->PushBack(it.Get());
++it;
}
otbMsgDevMacro(<<"ImageLayer::RenderHistogram() Sample list generated ("<<listSample->Size()<<" samples, "<<histogramSource->GetNumberOfComponentsPerPixel()<<" bands)");
// Create the histogram generation filter
typename HistogramFilterType::Pointer histogramFilter = HistogramFilterType::New();
...
...
@@ -174,6 +181,7 @@ ImageLayer<TImage,TOutputImage>
// Generate
histogramFilter->Update();
otbMsgDevMacro(<<"ImageLayer::RenderHistogram() Histogram has been updated");
// Retrieve the histogram
m_Histogram = histogramFilter->GetOutput();
...
...
@@ -185,31 +193,37 @@ void
ImageLayer<TImage,TOutputImage>
::AutoMinMaxRenderingFunctionSetup()
{
// Check for an existing histogram
if(m_Histogram.IsNull())
{
itkExceptionMacro(<<"Empty histogram, can not use auto min/max evaluation.");
}
const unsigned int nbComps = m_Image->GetNumberOfComponentsPerPixel();
typename RenderingFunctionType::ExtremaVectorType min, max;
// For each components, use the histogram to compute min and max
for(unsigned int comp = 0; comp < nbComps;++comp)
if(!m_AutoMinMaxUpToDate)
{
// Compute quantiles
min.push_back(m_Histogram->Quantile(comp,m_AutoMinMaxQuantile));
max.push_back(m_Histogram->Quantile(comp,1.-m_AutoMinMaxQuantile));
// Check for an existing histogram
if(m_Histogram.IsNull())
{
itkExceptionMacro(<<"Empty histogram, can not use auto min/max evaluation.");
}
otbMsgDevMacro(<<"ImageLayer::AutoMinMaxRenderingFunctionSetup(): Updating min/max from histogram");
const unsigned int nbComps = m_Image->GetNumberOfComponentsPerPixel();
typename RenderingFunctionType::ExtremaVectorType min, max;
otbMsgDevMacro(<<"ImageLayer::AutoMinMaxRenderingFunctionSetup(): "<<nbComps<<" components, quantile= "<<100*m_AutoMinMaxQuantile<<" %");
// For each components, use the histogram to compute min and max
for(unsigned int comp = 0; comp < nbComps;++comp)
{
// Compute quantiles
min.push_back(m_Histogram->Quantile(comp,m_AutoMinMaxQuantile));
max.push_back(m_Histogram->Quantile(comp,1.-m_AutoMinMaxQuantile));
otbMsgDevMacro(<<"ImageLayer::AutoMinMaxRenderingFunctionSetup(): component "<<comp<<", min= "<<min.back()<<", max= "<<max.back());
}
// Setup rendering function
m_RenderingFunction->SetMinimum(min);
m_RenderingFunction->SetMaximum(max);
m_QuicklookRenderingFilter->Modified();
m_ExtractRenderingFilter->Modified();
m_ScaledExtractRenderingFilter->Modified();
m_AutoMinMaxUpToDate = true;
}
// Setup rendering function
m_RenderingFunction->SetMinimum(min);
m_RenderingFunction->SetMaximum(max);
m_QuicklookRenderingFilter->Modified();
m_ExtractRenderingFilter->Modified();
m_ScaledExtractRenderingFilter->Modified();
m_AutoMinMaxUpToDate = true;
}
}
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment