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
503c7010
Commit
503c7010
authored
16 years ago
by
Julien Michel
Browse files
Options
Downloads
Patches
Plain Diff
BUG: (Visu Refactoring) Missing initialization
parent
a2ce1e62
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/VisuRefac/otbImageLayer.h
+8
-8
8 additions, 8 deletions
Code/VisuRefac/otbImageLayer.h
Code/VisuRefac/otbImageLayer.txx
+28
-21
28 additions, 21 deletions
Code/VisuRefac/otbImageLayer.txx
with
36 additions
and
29 deletions
Code/VisuRefac/otbImageLayer.h
+
8
−
8
View file @
503c7010
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
#include
"otbRenderingImageFilter.h"
#include
"otbRenderingImageFilter.h"
#include
"itkExtractImageFilter.h"
#include
"itkExtractImageFilter.h"
#include
"itkListSample.h"
#include
"itkListSample.h"
#include
"otbListSampleTo
VariableDimension
HistogramGenerator.h"
#include
"otbListSampleToHistogram
List
Generator.h"
#include
"otbStandardRenderingFunction.h"
#include
"otbStandardRenderingFunction.h"
namespace
otb
namespace
otb
...
@@ -70,12 +70,13 @@ public:
...
@@ -70,12 +70,13 @@ public:
typedef
itk
::
VariableLengthVector
<
InternalPixelType
>
SampleType
;
typedef
itk
::
VariableLengthVector
<
InternalPixelType
>
SampleType
;
typedef
itk
::
Statistics
::
ListSample
<
SampleType
>
ListSampleType
;
typedef
itk
::
Statistics
::
ListSample
<
SampleType
>
ListSampleType
;
typedef
otb
::
ListSampleTo
VariableDimension
HistogramGenerator
typedef
otb
::
ListSampleToHistogram
List
Generator
<
ListSampleType
,
InternalPixelType
,
DFContainerType
>
HistogramFilterType
;
<
ListSampleType
,
InternalPixelType
,
DFContainerType
>
HistogramFilterType
;
typedef
typename
HistogramFilterType
::
HistogramType
HistogramType
;
typedef
typename
HistogramFilterType
::
HistogramType
HistogramType
;
typedef
typename
HistogramType
::
Pointer
HistogramPointerType
;
typedef
typename
HistogramType
::
Pointer
HistogramPointerType
;
typedef
typename
HistogramFilterType
::
HistogramListType
HistogramListType
;
typedef
typename
HistogramListType
::
Pointer
HistogramListPointerType
;
/** Rendering part */
/** Rendering part */
typedef
RenderingImageFilter
<
TImage
,
TOutputImage
>
RenderingFilterType
;
typedef
RenderingImageFilter
<
TImage
,
TOutputImage
>
RenderingFilterType
;
typedef
typename
RenderingFilterType
::
Pointer
RenderingFilterPointerType
;
typedef
typename
RenderingFilterType
::
Pointer
RenderingFilterPointerType
;
...
@@ -110,9 +111,8 @@ public:
...
@@ -110,9 +111,8 @@ public:
}
}
itkGetObjectMacro
(
Quicklook
,
ImageType
);
itkGetObjectMacro
(
Quicklook
,
ImageType
);
/** Set/Get the histogram list */
/** Get the histogram list */
itkSetObjectMacro
(
Histogram
,
HistogramType
);
itkGetObjectMacro
(
HistogramList
,
HistogramListType
);
itkGetObjectMacro
(
Histogram
,
HistogramType
);
/** Set/Get the rendering function */
/** Set/Get the rendering function */
void
SetRenderingFunction
(
RenderingFunctionType
*
function
)
void
SetRenderingFunction
(
RenderingFunctionType
*
function
)
...
@@ -209,7 +209,7 @@ private:
...
@@ -209,7 +209,7 @@ private:
ImagePointerType
m_Image
;
ImagePointerType
m_Image
;
/** Joint Histogram */
/** Joint Histogram */
HistogramPointerType
m_Histogram
;
Histogram
List
PointerType
m_Histogram
List
;
/** Rendering function */
/** Rendering function */
RenderingFunctionPointerType
m_RenderingFunction
;
RenderingFunctionPointerType
m_RenderingFunction
;
...
...
This diff is collapsed.
Click to expand it.
Code/VisuRefac/otbImageLayer.txx
+
28
−
21
View file @
503c7010
...
@@ -20,14 +20,15 @@
...
@@ -20,14 +20,15 @@
#include "itkImageRegionConstIterator.h"
#include "itkImageRegionConstIterator.h"
#include "otbMacro.h"
#include "otbMacro.h"
#include "itkTimeProbe.h"
namespace otb
namespace otb
{
{
template <class TImage, class TOutputImage>
template <class TImage, class TOutputImage>
ImageLayer<TImage,TOutputImage>
ImageLayer<TImage,TOutputImage>
::ImageLayer() : m_Quicklook(), m_Image(), m_Histogram(), m_RenderingFunction(),
::ImageLayer() : m_Quicklook(), m_Image(), m_Histogram
List
(), m_RenderingFunction(),
m_NumberOfHistogramBins(2
0
), m_AutoMinMax(true), m_AutoMinMaxUpToDate(false), m_AutoMinMaxQuantile(0.02),
m_NumberOfHistogramBins(2
55
), m_AutoMinMax(true), m_AutoMinMaxUpToDate(false), m_AutoMinMaxQuantile(0.02),
m_QuicklookRenderingFilter(), m_ExtractRenderingFilter(), m_ScaledExtractRenderingFilter(),
m_QuicklookRenderingFilter(), m_ExtractRenderingFilter(), m_ScaledExtractRenderingFilter(),
m_ExtractFilter(), m_ScaledExtractFilter()
m_ExtractFilter(), m_ScaledExtractFilter()
{
{
...
@@ -91,17 +92,23 @@ ImageLayer<TImage,TOutputImage>
...
@@ -91,17 +92,23 @@ ImageLayer<TImage,TOutputImage>
// Render quicklook
// Render quicklook
if(this->GetHasQuicklook())
if(this->GetHasQuicklook())
{
{
otbMsgDevMacro(<<"ImageLayer::RenderImages(): Regenerating quicklook");
itk::TimeProbe probe;
probe.Start();
m_QuicklookRenderingFilter->Update();
m_QuicklookRenderingFilter->Update();
this->SetRenderedQuicklook(m_QuicklookRenderingFilter->GetOutput());
this->SetRenderedQuicklook(m_QuicklookRenderingFilter->GetOutput());
probe.Stop();
otbMsgDevMacro(<<"ImageLayer::RenderImages():"<<" ("<<this->GetName()<<")"<< " quicklook regenerated ("<<probe.GetMeanTime()<<" s.)");
}
}
// If there are pixels to render
// If there are pixels to render
if(this->GetExtractRegion().GetNumberOfPixels() > 0)
if(this->GetExtractRegion().GetNumberOfPixels() > 0)
{
{
otbMsgDevMacro(<<"ImageLayer::RenderImages(): Regenerating extract");
itk::TimeProbe probe;
probe.Start();
m_ExtractRenderingFilter->GetOutput()->SetRequestedRegion(this->GetExtractRegion());
m_ExtractRenderingFilter->GetOutput()->SetRequestedRegion(this->GetExtractRegion());
m_ExtractRenderingFilter->Update();
m_ExtractRenderingFilter->Update();
this->SetRenderedExtract(m_ExtractRenderingFilter->GetOutput());
this->SetRenderedExtract(m_ExtractRenderingFilter->GetOutput());
probe.Stop();
otbMsgDevMacro(<<"ImageLayer::RenderImages():"<<" ("<<this->GetName()<<")"<< " extract regenerated ("<<probe.GetMeanTime()<<" s.)");
}
}
else
else
{
{
...
@@ -111,11 +118,14 @@ ImageLayer<TImage,TOutputImage>
...
@@ -111,11 +118,14 @@ ImageLayer<TImage,TOutputImage>
// If there are pixels to render
// If there are pixels to render
if(this->GetScaledExtractRegion().GetNumberOfPixels() > 0)
if(this->GetScaledExtractRegion().GetNumberOfPixels() > 0)
{
{
otbMsgDevMacro(<<"ImageLayer::RenderImages(): Regenerating scaled extract");
itk::TimeProbe probe;
probe.Start();
m_ScaledExtractRenderingFilter->GetOutput()->SetRequestedRegion(this->GetScaledExtractRegion());
m_ScaledExtractRenderingFilter->GetOutput()->SetRequestedRegion(this->GetScaledExtractRegion());
m_ScaledExtractRenderingFilter->Update();
m_ScaledExtractRenderingFilter->Update();
this->SetRenderedScaledExtract(m_ScaledExtractRenderingFilter->GetOutput());
this->SetRenderedScaledExtract(m_ScaledExtractRenderingFilter->GetOutput());
this->SetHasScaledExtract(true);
this->SetHasScaledExtract(true);
probe.Stop();
otbMsgDevMacro(<<"ImageLayer::RenderImages():"<<" ("<<this->GetName()<<")"<< " scaled extract regenerated ("<<probe.GetMeanTime()<<" s.)");
}
}
else
else
{
{
...
@@ -143,9 +153,9 @@ ImageLayer<TImage,TOutputImage>
...
@@ -143,9 +153,9 @@ ImageLayer<TImage,TOutputImage>
}
}
// Check if we need to generate the histogram again
// Check if we need to generate the histogram again
if( !m_Histogram || (histogramSource->GetUpdateMTime() < histogramSource->GetPipelineMTime()) )
if( !m_Histogram
List
|| (histogramSource->GetUpdateMTime() < histogramSource->GetPipelineMTime()) )
{
{
otbMsgDevMacro(<<"ImageLayer::RenderHistogram(): Regenerating histogram due to pippeline update.");
otbMsgDevMacro(<<"ImageLayer::RenderHistogram():
"<<" ("<<this->GetName()<<")"<< "
Regenerating histogram due to pippeline update.");
m_AutoMinMaxUpToDate = false;
m_AutoMinMaxUpToDate = false;
// Update the histogram source
// Update the histogram source
...
@@ -167,24 +177,21 @@ ImageLayer<TImage,TOutputImage>
...
@@ -167,24 +177,21 @@ ImageLayer<TImage,TOutputImage>
listSample->PushBack(it.Get());
listSample->PushBack(it.Get());
++it;
++it;
}
}
otbMsgDevMacro(<<"ImageLayer::RenderHistogram() Sample list generated ("<<listSample->Size()<<" samples, "<<histogramSource->GetNumberOfComponentsPerPixel()<<" bands)");
otbMsgDevMacro(<<"ImageLayer::RenderHistogram()
"<<" ("<<this->GetName()<<")"<< "
Sample list generated ("<<listSample->Size()<<" samples, "<<histogramSource->GetNumberOfComponentsPerPixel()<<" bands)");
// Create the histogram generation filter
// Create the histogram generation filter
typename HistogramFilterType::Pointer histogramFilter = HistogramFilterType::New();
typename HistogramFilterType::Pointer histogramFilter = HistogramFilterType::New();
histogramFilter->SetListSample(listSample);
histogramFilter->SetListSample(listSample);
typename HistogramFilterType::HistogramSizeType binSizes(histogramSource->GetNumberOfComponentsPerPixel());
histogramFilter->SetNumberOfBins(m_NumberOfHistogramBins);
binSizes.Fill(m_NumberOfHistogramBins);
histogramFilter->SetNumberOfBins(binSizes);
// Generate
// Generate
histogramFilter->Update();
histogramFilter->Update();
otbMsgDevMacro(<<"ImageLayer::RenderHistogram() Histogram has been updated");
otbMsgDevMacro(<<"ImageLayer::RenderHistogram()
"<<" ("<<this->GetName()<<")"<< "
Histogram has been updated");
// Retrieve the histogram
// Retrieve the histogram
m_Histogram = histogramFilter->GetOutput();
m_Histogram
List
= histogramFilter->GetOutput();
}
}
}
}
...
@@ -196,23 +203,23 @@ ImageLayer<TImage,TOutputImage>
...
@@ -196,23 +203,23 @@ ImageLayer<TImage,TOutputImage>
if(!m_AutoMinMaxUpToDate)
if(!m_AutoMinMaxUpToDate)
{
{
// Check for an existing histogram
// Check for an existing histogram
if(m_Histogram.IsNull())
if(m_Histogram
List
.IsNull())
{
{
itkExceptionMacro(<<"Empty histogram, can not use auto min/max evaluation.");
itkExceptionMacro(<<"Empty histogram, can not use auto min/max evaluation.");
}
}
otbMsgDevMacro(<<"ImageLayer::AutoMinMaxRenderingFunctionSetup(): Updating min/max from histogram");
otbMsgDevMacro(<<"ImageLayer::AutoMinMaxRenderingFunctionSetup():
"<<" ("<<this->GetName()<<")"<< "
Updating min/max from histogram");
const unsigned int nbComps = m_Image->GetNumberOfComponentsPerPixel();
const unsigned int nbComps = m_Image->GetNumberOfComponentsPerPixel();
typename RenderingFunctionType::ExtremaVectorType min, max;
typename RenderingFunctionType::ExtremaVectorType min, max;
otbMsgDevMacro(<<"ImageLayer::AutoMinMaxRenderingFunctionSetup(): "<<nbComps<<" components, quantile= "<<100*m_AutoMinMaxQuantile<<" %");
otbMsgDevMacro(<<"ImageLayer::AutoMinMaxRenderingFunctionSetup():
"<<" ("<<this->GetName()<<")
"<<nbComps<<" components, quantile= "<<100*m_AutoMinMaxQuantile<<" %");
// For each components, use the histogram to compute min and max
// For each components, use the histogram to compute min and max
for(unsigned int comp = 0; comp < nbComps;++comp)
for(unsigned int comp = 0; comp < nbComps;++comp)
{
{
// Compute quantiles
// Compute quantiles
min.push_back(m_Histogram->Quantile(
comp
,m_AutoMinMaxQuantile));
min.push_back(m_Histogram
List->GetNthElement(comp)
->Quantile(
0
,m_AutoMinMaxQuantile));
max.push_back(m_Histogram->Quantile(
comp
,1
.
-m_AutoMinMaxQuantile));
max.push_back(m_Histogram
List->GetNthElement(comp)
->Quantile(
0
,1-m_AutoMinMaxQuantile));
otbMsgDevMacro(<<"ImageLayer::AutoMinMaxRenderingFunctionSetup(): component "<<comp<<", min= "<<min.back()<<", max= "<<max.back());
otbMsgDevMacro(<<"ImageLayer::AutoMinMaxRenderingFunctionSetup():
"<<" ("<<this->GetName()<<")"<< "
component "<<comp<<", min= "<<min.back()<<", max= "<<max.back());
}
}
// Setup rendering function
// Setup rendering function
...
...
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