Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Main Repositories
otb
Commits
4d4bc36c
Commit
4d4bc36c
authored
Jan 06, 2010
by
Cyrille Valladeau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH : add image size setting in functor
parent
7c063ee8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
17 deletions
+33
-17
Code/Radiometry/otbTerraSarCalibrationImageFilter.h
Code/Radiometry/otbTerraSarCalibrationImageFilter.h
+8
-0
Code/Radiometry/otbTerraSarCalibrationImageFilter.txx
Code/Radiometry/otbTerraSarCalibrationImageFilter.txx
+20
-12
Code/Radiometry/otbTerraSarFunctors.txx
Code/Radiometry/otbTerraSarFunctors.txx
+4
-4
Testing/Code/Radiometry/otbTerraSarCalibrationImageFilterTest.cxx
...Code/Radiometry/otbTerraSarCalibrationImageFilterTest.cxx
+1
-1
No files found.
Code/Radiometry/otbTerraSarCalibrationImageFilter.h
View file @
4d4bc36c
...
...
@@ -78,6 +78,8 @@ public:
typedef
itk
::
MetaDataDictionary
MetaDataDictionaryType
;
typedef
typename
FunctorType
::
DoubleVectorType
DoubleVectorType
;
typedef
typename
FunctorType
::
DoubleVectorVectorType
DoubleVectorVectorType
;
typedef
typename
InputImageType
::
SizeType
SizeType
;
// typedef typename FunctorType::LIntVectorType LIntVectorType;
/** Accessors */
...
...
@@ -102,6 +104,9 @@ public:
/** Vector of vector that contain noise polinomial coefficient */
void
SetNoisePolynomialCoefficientsList
(
DoubleVectorVectorType
vect
);
DoubleVectorVectorType
GetNoisePolynomialCoefficientsList
()
const
;
/** Image size (setter is protected)*/
SizeType
GetImageSize
()
const
;
/** Fast Calibration Method. If set to trus, will consider only the first noise coefficient else,
* will use all of them and applied it according to its acquisition UTC time and the coordinates
* of the pixel in the image. */
...
...
@@ -121,6 +126,9 @@ protected:
TerraSarCalibrationImageFilter
();
/** Destructor */
virtual
~
TerraSarCalibrationImageFilter
()
{};
/** Image Size setter*/
void
SetImageSize
(
SizeType
size
);
/** Initialize the functor vector */
void
BeforeThreadedGenerateData
();
...
...
Code/Radiometry/otbTerraSarCalibrationImageFilter.txx
View file @
4d4bc36c
...
...
@@ -42,18 +42,7 @@ TerraSarCalibrationImageFilter<TInputImage,TOutputImage>
{
Superclass::BeforeThreadedGenerateData();
// If the user doesn't set it AND the metadata is available, set calFactor using image metadata
// std::cout<<this->GetCalFactor()<<std::endl;
// if (this->GetCalFactor() == itk::NumericTraits<double>::min())
// {
// /** TODO : use a factory for RADAR image metadata interface */
// TerraSarImageMetadataInterface::Pointer lImageMetadata = otb::TerraSarImageMetadataInterface::New();
// if( !lImageMetadata->CanRead(this->GetInput()->GetMetaDataDictionary()) )
// {
// itkExceptionMacro(<<"Invalid input image. Only TerraSar images are supproted");
// }
// this->SetCalFactor( lImageMetadata->GetCalibrationFactor(this->GetInput()->GetMetaDataDictionary()) );
// }
this->SetImageSize( this->GetInput()->GetLargestPossibleRegion().GetSize() );
// Load metadata
TerraSarImageMetadataInterface::Pointer lImageMetadata = otb::TerraSarImageMetadataInterface::New();
...
...
@@ -174,6 +163,7 @@ TerraSarCalibrationImageFilter<TInputImage,TOutputImage>
{
double mean = lImageMetadata->GetMeanIncidenceAngles(this->GetInput()->GetMetaDataDictionary());
this->SetLocalIncidentAngle(mean);
this->SetLocalIncidentAngle(mean);
}
else
{
...
...
@@ -298,6 +288,24 @@ TerraSarCalibrationImageFilter<TInputImage,TOutputImage>
return this->GetFunctor().GetNoisePolynomialCoefficientsList();
}
template <class TInputImage, class TOutputImage>
void
TerraSarCalibrationImageFilter<TInputImage,TOutputImage>
::SetImageSize( SizeType size )
{
this->GetFunctor().SetImageSize( size );
this->Modified();
}
template <class TInputImage, class TOutputImage>
typename TerraSarCalibrationImageFilter<TInputImage,TOutputImage>::SizeType
TerraSarCalibrationImageFilter<TInputImage,TOutputImage>
::GetImageSize() const
{
return this->GetFunctor().GetImageSize();
}
template <class TInputImage, class TOutputImage>
void
TerraSarCalibrationImageFilter<TInputImage,TOutputImage>
...
...
Code/Radiometry/otbTerraSarFunctors.txx
View file @
4d4bc36c
...
...
@@ -94,20 +94,18 @@ template <class TInput, class TOutput>
double
TerraSarCalibrationImageFunctor<TInput, TOutput>
::ComputeCurrentNoise( unsigned int colId )
{
{
double curRange = 0.;
double width_2 = static_cast<double>(m_ImageSize[0])/2.;
// Use +1 because image start index is 0
if( colId < static_cast<unsigned int>(width_2) )
{
curRange = m_NoiseRangeValidityMin + ( m_NoiseRangeValidityRef-m_NoiseRangeValidityMin )/width_2 * static_cast<double>(colId+1);
}
else
{
{
curRange = m_NoiseRangeValidityRef + ( m_NoiseRangeValidityMax-m_NoiseRangeValidityRef )/width_2 * (static_cast<double>(colId+1) - width_2 );
}
return curRange;
}
...
...
@@ -159,6 +157,7 @@ TerraSarCalibrationImageFunctor<TInput, TOutput>
::operator()(const TInput & inPix, IndexType index)
{
double diffCurRange = ComputeCurrentNoise( static_cast<unsigned int>(index[0]) ) - this->GetNoiseRangeValidityRef();
DoubleVectorType curCoeff = this->ComputeCurrentCoeffs( static_cast<unsigned int>(index[1]) );
double outRadBr = this->GetBrightness()( static_cast<double>(inPix) );
...
...
@@ -168,6 +167,7 @@ TerraSarCalibrationImageFunctor<TInput, TOutput>
{
NEBN += curCoeff[i]*vcl_pow( diffCurRange, static_cast<double>(i));
}
double sigma = ( outRadBr - this->GetCalFactor()*NEBN ) * this->GetSinLocalIncidentAngle();
return static_cast<TOutput>(sigma);
...
...
Testing/Code/Radiometry/otbTerraSarCalibrationImageFilterTest.cxx
View file @
4d4bc36c
...
...
@@ -72,7 +72,6 @@ int otbTerraSarCalibrationImageFilterTest(int argc, char * argv[])
filter
->
SetNoiseRangeValidityMax
(
1
);
filter
->
SetNoiseRangeValidityRef
(
0.5
);
filter
->
SetLocalIncidentAngle
(
15
);
filter
->
SetLocalIncidentAngle
(
15
);
std
::
vector
<
double
>
timeUtc
;
timeUtc
.
push_back
(
1.
);
...
...
@@ -84,6 +83,7 @@ int otbTerraSarCalibrationImageFilterTest(int argc, char * argv[])
filter
->
SetInput
(
reader
->
GetOutput
());
writer
->
SetInput
(
filter
->
GetOutput
());
writer
->
Update
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment