Skip to content
Snippets Groups Projects
Commit 3ace8b21 authored by Julien Michel's avatar Julien Michel
Browse files

BUG: Fixing bug #87 (package OTB-Applications)

parent a7774964
No related branches found
No related tags found
No related merge requests found
......@@ -118,12 +118,9 @@ ImageViewerBase<TPixel,TLabel>
while ( !it.IsAtEnd() )
{
PixelType pixel = it.Get();
// for(unsigned int i = 0;i<m_InputImage->GetNumberOfComponentsPerPixel();++i)
// {
double re = static_cast<double>(pixel[m_RedChannelIndex]);
double im = static_cast<double>(pixel[m_GreenChannelIndex]);
sl->GetNthElement(0)->PushBack(vcl_sqrt(static_cast<double>(re*re+im*im)));
// }
++it;
}
}
......@@ -133,10 +130,7 @@ ImageViewerBase<TPixel,TLabel>
while ( !it.IsAtEnd() )
{
PixelType pixel = it.Get();
// for(unsigned int i = 0;i<m_InputImage->GetNumberOfComponentsPerPixel();++i)
// {
sl->GetNthElement(0)->PushBack(vcl_atan2(static_cast<double>(pixel[m_GreenChannelIndex]),static_cast<double>(pixel[m_RedChannelIndex])));
// }
++it;
}
......@@ -344,11 +338,11 @@ ImageViewerBase<TPixel,TLabel>
m_InterfaceBoxesList->PushBack(box);
}
InitializeViewModel();
// Compute the normalization factors
ComputeNormalizationFactors();
InitializeViewModel();
m_RedHistogramWidget->SetParent(this);
m_BlueHistogramWidget->SetParent(this);
m_GreenHistogramWidget->SetParent(this);
......@@ -1051,6 +1045,20 @@ void
ImageViewerBase<TPixel,TLabel>
::SetViewModel(ViewModelType viewModel)
{
// Channel indices outofbound check
if(m_RedChannelIndex >= m_InputImage->GetNumberOfComponentsPerPixel())
{
itkExceptionMacro(<<"Red channel index out of bound.");
}
if(viewModel != ScrollWidgetType::GRAYSCALE && m_GreenChannelIndex >= m_InputImage->GetNumberOfComponentsPerPixel())
{
itkExceptionMacro(<<"Green channel index out of bound.");
}
if(viewModel == ScrollWidgetType::RGB && m_BlueChannelIndex >= m_InputImage->GetNumberOfComponentsPerPixel())
{
itkExceptionMacro(<<"Blue channel index out of bound.");
}
switch (viewModel)
{
case ScrollWidgetType::RGB:
......
......@@ -441,6 +441,22 @@ void
ImageWidgetBase<TPixel>
::RebuildOpenGlBuffer(void)
{
// Channel indices outofbound check
if(m_RedChannelIndex >= m_Image->GetNumberOfComponentsPerPixel())
{
itkExceptionMacro(<<"Red channel index out of bound.");
}
if(m_ViewModel != GRAYSCALE && m_GreenChannelIndex >= m_Image->GetNumberOfComponentsPerPixel())
{
itkExceptionMacro(<<"Green channel index out of bound.");
}
if(m_ViewModel == RGB && m_BlueChannelIndex >= m_Image->GetNumberOfComponentsPerPixel())
{
itkExceptionMacro(<<"Blue channel index out of bound.");
}
//otbMsgDebugMacro(<<"RebuildOpenGlBuffer");
if (m_OpenGlBuffer != NULL)
{
......
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