Skip to content
Snippets Groups Projects
Commit 653b9a0f authored by Antoine Regimbeau's avatar Antoine Regimbeau
Browse files

BUG: signed spacing and wrong inclusion of if

parent f991ce52
No related branches found
No related tags found
No related merge requests found
...@@ -499,15 +499,15 @@ private: ...@@ -499,15 +499,15 @@ private:
{ {
m_ThumbSize[0] = GetParameterInt("spatial.local.w"); m_ThumbSize[0] = GetParameterInt("spatial.local.w");
m_ThumbSize[1] = GetParameterInt("spatial.local.h"); m_ThumbSize[1] = GetParameterInt("spatial.local.h");
}
if ( size[0] == m_ThumbSize[0] && size[1] == m_ThumbSize[1] ) if ( size[0] == m_ThumbSize[0] && size[1] == m_ThumbSize[1] )
{ {
std::ostringstream oss; std::ostringstream oss;
oss<<"Warning you choose to compute the histogram with a local " oss<<"Warning you choose to compute the histogram with a local "
"method whereas you have selected the whole image for the thumbnail " "method whereas you have selected the whole image for the thumbnail "
"size. In order to use less memory consider using the global option for " "size. In order to use less memory consider using the global option for "
"histogram computation."; "histogram computation.";
otbAppLogWARNING( << oss.str() ); otbAppLogWARNING( << oss.str() );
}
} }
} }
...@@ -855,7 +855,7 @@ private: ...@@ -855,7 +855,7 @@ private:
HistoPersistentFilterType::HistogramType::Pointer histo; HistoPersistentFilterType::HistogramType::Pointer histo;
FloatImageType::SpacingType inputSpacing ( FloatImageType::SpacingType inputSpacing (
GetParameterImage("in")->GetSpacing() ); GetParameterImage("in")->GetSignedSpacing() );
FloatImageType::PointType inputOrigin ( FloatImageType::PointType inputOrigin (
GetParameterImage("in")->GetOrigin() ); GetParameterImage("in")->GetOrigin() );
...@@ -901,7 +901,7 @@ private: ...@@ -901,7 +901,7 @@ private:
histoVectorImage->SetBufferedRegion( sizeOne ); histoVectorImage->SetBufferedRegion( sizeOne );
histoVectorImage->SetRequestedRegion( sizeOne ); histoVectorImage->SetRequestedRegion( sizeOne );
histoVectorImage->SetLargestPossibleRegion( sizeOne ); histoVectorImage->SetLargestPossibleRegion( sizeOne );
histoVectorImage->SetSpacing( histoSpacing ) ; histoVectorImage->SetSignedSpacing( histoSpacing ) ;
histoVectorImage->SetOrigin( histoOrigin ); histoVectorImage->SetOrigin( histoOrigin );
histoVectorImage->Allocate(); histoVectorImage->Allocate();
for (unsigned int j = 0 ; j < nbBin ; j++ ) for (unsigned int j = 0 ; j < nbBin ; j++ )
......
...@@ -100,10 +100,10 @@ void ApplyGainFilter < TInputImage , TLut , TOutputImage > ...@@ -100,10 +100,10 @@ void ApplyGainFilter < TInputImage , TLut , TOutputImage >
typename InputImageType::ConstPointer input ( GetInputImage() ); typename InputImageType::ConstPointer input ( GetInputImage() );
if ( m_ThumbSizeFromSpacing ) if ( m_ThumbSizeFromSpacing )
{ {
m_ThumbSize[0] = std::round( lut->GetSpacing()[0] m_ThumbSize[0] = std::round( lut->GetSignedSpacing()[0]
/ input->GetSpacing()[0] ); / input->GetSignedSpacing()[0] );
m_ThumbSize[1] = std::round( lut->GetSpacing()[1] m_ThumbSize[1] = std::round( lut->GetSignedSpacing()[1]
/ input->GetSpacing()[1] ); / input->GetSignedSpacing()[1] );
} }
m_Step = static_cast<double>( m_Max - m_Min ) \ m_Step = static_cast<double>( m_Max - m_Min ) \
/ static_cast<double>( lut->GetVectorLength() - 1 ); / static_cast<double>( lut->GetVectorLength() - 1 );
......
...@@ -123,13 +123,13 @@ void ComputeHistoFilter < TInputImage , TOutputImage > ...@@ -123,13 +123,13 @@ void ComputeHistoFilter < TInputImage , TOutputImage >
region.SetIndex(start); region.SetIndex(start);
output->SetNumberOfComponentsPerPixel(m_NbBin); output->SetNumberOfComponentsPerPixel(m_NbBin);
output->SetLargestPossibleRegion(region); output->SetLargestPossibleRegion(region);
typename InputImageType::SpacingType inputSpacing ( input->GetSpacing() ); typename InputImageType::SpacingType inputSpacing ( input->GetSignedSpacing() );
typename InputImageType::PointType inputOrigin ( input->GetOrigin() ); typename InputImageType::PointType inputOrigin ( input->GetOrigin() );
typename OutputImageType::SpacingType histoSpacing ; typename OutputImageType::SpacingType histoSpacing ;
histoSpacing[0] = inputSpacing[0] * m_ThumbSize[0] ; histoSpacing[0] = inputSpacing[0] * m_ThumbSize[0] ;
histoSpacing[1] = inputSpacing[1] * m_ThumbSize[1] ; histoSpacing[1] = inputSpacing[1] * m_ThumbSize[1] ;
output->SetSpacing( histoSpacing ) ; output->SetSignedSpacing( histoSpacing ) ;
typename OutputImageType::PointType histoOrigin ; typename OutputImageType::PointType histoOrigin ;
histoOrigin[0] = histoSpacing[0] / 2 + inputOrigin[0] - inputSpacing[0] / 2 ; histoOrigin[0] = histoSpacing[0] / 2 + inputOrigin[0] - inputSpacing[0] / 2 ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment