Commit bd07a729 authored by Cyrille Valladeau's avatar Cyrille Valladeau
Browse files

STYLE : try/catch blocs supression in Fusion testing.

parent 0d4e0f38
......@@ -10,9 +10,9 @@
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
......@@ -27,54 +27,38 @@
int otbBayesianFusionFilter( int argc, char * argv[] )
{
try
{
const char * multispect = argv[1];
const char * multispectinterp = argv[2];
const char * panchro = argv[3];
const char * output = argv[4];
const char * multispect = argv[1];
const char * multispectinterp = argv[2];
const char * panchro = argv[3];
const char * output = argv[4];
const unsigned int Dimension = 2;
typedef double PixelType;
const unsigned int Dimension = 2;
typedef double PixelType;
typedef otb::VectorImage<PixelType,Dimension> VectorImageType;
typedef otb::Image<PixelType,Dimension> PanchroImageType;
typedef otb::ImageFileReader<VectorImageType> VectorReaderType;
typedef otb::ImageFileReader<PanchroImageType> ImageReaderType;
typedef otb::StreamingImageFileWriter<VectorImageType> VectorImageWriterType;
typedef otb::BayesianFusionFilter<VectorImageType, VectorImageType, PanchroImageType, VectorImageType> FilterType;
typedef otb::VectorImage<PixelType,Dimension> VectorImageType;
typedef otb::Image<PixelType,Dimension> PanchroImageType;
typedef otb::ImageFileReader<VectorImageType> VectorReaderType;
typedef otb::ImageFileReader<PanchroImageType> ImageReaderType;
typedef otb::StreamingImageFileWriter<VectorImageType> VectorImageWriterType;
typedef otb::BayesianFusionFilter<VectorImageType, VectorImageType, PanchroImageType, VectorImageType> FilterType;
VectorReaderType::Pointer multiSpectReader = VectorReaderType::New();
VectorReaderType::Pointer multiSpectInterpReader = VectorReaderType::New();
ImageReaderType::Pointer panchroReader = ImageReaderType::New();
FilterType::Pointer filter = FilterType::New();
VectorImageWriterType::Pointer writer = VectorImageWriterType::New();
VectorReaderType::Pointer multiSpectReader = VectorReaderType::New();
VectorReaderType::Pointer multiSpectInterpReader = VectorReaderType::New();
ImageReaderType::Pointer panchroReader = ImageReaderType::New();
FilterType::Pointer filter = FilterType::New();
VectorImageWriterType::Pointer writer = VectorImageWriterType::New();
multiSpectReader->SetFileName(multispect);
multiSpectInterpReader->SetFileName(multispectinterp);
panchroReader->SetFileName(panchro);
multiSpectReader->SetFileName(multispect);
multiSpectInterpReader->SetFileName(multispectinterp);
panchroReader->SetFileName(panchro);
filter->SetMultiSpect(multiSpectReader->GetOutput());
filter->SetMultiSpectInterp(multiSpectInterpReader->GetOutput());
filter->SetPanchro(panchroReader->GetOutput());
writer->SetInput( filter->GetOutput() );
writer->SetFileName(output);
writer->Update();
}
catch( itk::ExceptionObject & err )
{
std::cout << "Exception itk::ExceptionObject levee !" << std::endl;
std::cout << err << std::endl;
return EXIT_FAILURE;
}
catch( ... )
{
std::cout << "Exception levee inconnue !" << std::endl;
return EXIT_FAILURE;
}
filter->SetMultiSpect(multiSpectReader->GetOutput());
filter->SetMultiSpectInterp(multiSpectInterpReader->GetOutput());
filter->SetPanchro(panchroReader->GetOutput());
writer->SetInput( filter->GetOutput() );
writer->SetFileName(output);
writer->Update();
return EXIT_SUCCESS;
......
......@@ -10,9 +10,9 @@
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
......@@ -27,35 +27,18 @@
int otbBayesianFusionFilterNew( int argc, char * argv[] )
{
try
{
const unsigned int Dimension = 2;
typedef double PixelType;
const unsigned int Dimension = 2;
typedef double PixelType;
typedef otb::VectorImage<PixelType,Dimension> VectorImageType;
typedef otb::Image<PixelType,Dimension> PanchroImageType;
typedef otb::ImageFileReader<VectorImageType> VectorReaderType;
typedef otb::ImageFileReader<PanchroImageType> ImageReaderType;
typedef otb::BayesianFusionFilter<VectorImageType, VectorImageType, PanchroImageType, VectorImageType> FilterType;
typedef otb::VectorImage<PixelType,Dimension> VectorImageType;
typedef otb::Image<PixelType,Dimension> PanchroImageType;
typedef otb::ImageFileReader<VectorImageType> VectorReaderType;
typedef otb::ImageFileReader<PanchroImageType> ImageReaderType;
typedef otb::BayesianFusionFilter<VectorImageType, VectorImageType, PanchroImageType, VectorImageType> FilterType;
FilterType::Pointer filter = FilterType::New();
FilterType::Pointer filter = FilterType::New();
}
catch( itk::ExceptionObject & err )
{
std::cout << "Exception itk::ExceptionObject levee !" << std::endl;
std::cout << err << std::endl;
return EXIT_FAILURE;
}
catch( ... )
{
std::cout << "Exception levee inconnue !" << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
......
......@@ -10,9 +10,9 @@
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
......@@ -41,44 +41,28 @@ namespace Functor
int otbFusionImageBaseNew( int argc, char * argv[] )
{
try
{
const unsigned int Dimension = 2;
typedef unsigned char InputPixelType;
typedef unsigned char OutputPixelType;
const unsigned int Dimension = 2;
typedef unsigned char InputPixelType;
typedef unsigned char OutputPixelType;
typedef otb::Image<InputPixelType,Dimension> InputPanchroImageType;
typedef otb::VectorImage<InputPixelType,Dimension> InputMultiSpectralImageType;
typedef otb::VectorImage<InputPixelType,Dimension> InputMultiSpectralInterpImageType;
typedef otb::Image<OutputPixelType,Dimension> OutputImageType;
typedef otb::Image<InputPixelType,Dimension> InputPanchroImageType;
typedef otb::VectorImage<InputPixelType,Dimension> InputMultiSpectralImageType;
typedef otb::VectorImage<InputPixelType,Dimension> InputMultiSpectralInterpImageType;
typedef otb::Image<OutputPixelType,Dimension> OutputImageType;
typedef otb::FusionImageBase<InputMultiSpectralImageType,
InputMultiSpectralInterpImageType,
InputPanchroImageType,
OutputImageType,
Functor::NewFunctorTest<InputMultiSpectralImageType::PixelType,
InputMultiSpectralInterpImageType::PixelType,
InputPanchroImageType::PixelType,
OutputImageType::PixelType>
> FusionImageBaseType;
typedef otb::FusionImageBase<InputMultiSpectralImageType,
InputMultiSpectralInterpImageType,
InputPanchroImageType,
OutputImageType,
Functor::NewFunctorTest<InputMultiSpectralImageType::PixelType,
InputMultiSpectralInterpImageType::PixelType,
InputPanchroImageType::PixelType,
OutputImageType::PixelType>
> FusionImageBaseType;
// Instantiation
FusionImageBaseType::Pointer base = FusionImageBaseType::New();
}
catch( itk::ExceptionObject & err )
{
std::cout << "Exception itk::ExceptionObject levee !" << std::endl;
std::cout << err << std::endl;
return EXIT_FAILURE;
}
catch( ... )
{
std::cout << "Exception levee inconnue !" << std::endl;
return EXIT_FAILURE;
}
// Instantiation
FusionImageBaseType::Pointer base = FusionImageBaseType::New();
return EXIT_SUCCESS;
}
......
......@@ -10,9 +10,9 @@
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
......@@ -25,76 +25,59 @@
#include "otbSimpleRcsPanSharpeningFusionImageFilter.h"
//int main( int argc, char * argv[] )
int otbSimpleRcsPanSharpeningFusionImageFilter( int argc, char * argv[] )
{
try
{
const char * panchro = argv[1];
const char * multispect = argv[2];
const char * output = argv[3];
const char * panchro = argv[1];
const char * multispect = argv[2];
const char * output = argv[3];
const unsigned int Dimension = 2;
typedef double PixelType;
const unsigned int Dimension = 2;
typedef double PixelType;
typedef otb::VectorImage<PixelType,Dimension> VectorImageType;
typedef otb::Image<PixelType,Dimension> PanchroImageType;
typedef otb::ImageFileReader<VectorImageType> VectorReaderType;
typedef otb::ImageFileReader<PanchroImageType> ImageReaderType;
typedef otb::StreamingImageFileWriter<VectorImageType> VectorImageWriterType;
typedef otb::SimpleRcsPanSharpeningFusionImageFilter
<PanchroImageType, VectorImageType, VectorImageType> FilterType;
typedef otb::VectorImage<PixelType,Dimension> VectorImageType;
typedef otb::Image<PixelType,Dimension> PanchroImageType;
typedef otb::ImageFileReader<VectorImageType> VectorReaderType;
typedef otb::ImageFileReader<PanchroImageType> ImageReaderType;
typedef otb::StreamingImageFileWriter<VectorImageType> VectorImageWriterType;
typedef otb::SimpleRcsPanSharpeningFusionImageFilter
<PanchroImageType, VectorImageType, VectorImageType> FilterType;
VectorReaderType::Pointer multiSpectReader = VectorReaderType::New();
ImageReaderType::Pointer panchroReader = ImageReaderType::New();
FilterType::Pointer filter = FilterType::New();
VectorImageWriterType::Pointer writer = VectorImageWriterType::New();
VectorReaderType::Pointer multiSpectReader = VectorReaderType::New();
ImageReaderType::Pointer panchroReader = ImageReaderType::New();
FilterType::Pointer filter = FilterType::New();
VectorImageWriterType::Pointer writer = VectorImageWriterType::New();
multiSpectReader->SetFileName(multispect);
panchroReader->SetFileName(panchro);
multiSpectReader->SetFileName(multispect);
panchroReader->SetFileName(panchro);
PanchroImageType::SizeType radius;
radius[0]=3;
radius[1]=3;
itk::Array< double > filterCoeffs;
filterCoeffs.SetSize((2*radius[0]+1)*(2*radius[1]+1));
PanchroImageType::SizeType radius;
radius[0]=3;
radius[1]=3;
itk::Array< double > filterCoeffs;
filterCoeffs.SetSize((2*radius[0]+1)*(2*radius[1]+1));
// double filterTmp[] = {
// 0.00390625, 0.0078125, 0.0117188, 0.015625, 0.0117188, 0.0078125, 0.00390625,
// 0.0078125, 0.015625, 0.0234375, 0.03125, 0.0234375, 0.015625, 0.0078125,
// 0.0117188, 0.0234375, 0.0351562, 0.046875, 0.0351562, 0.0234375, 0.0117188,
// 0.015625, 0.03125, 0.046875, 0.0625, 0.046875, 0.03125, 0.015625,
// 0.0117188, 0.0234375, 0.0351562, 0.046875, 0.0351562, 0.0234375, 0.0117188,
// 0.0078125, 0.015625, 0.0234375, 0.03125, 0.0234375, 0.015625, 0.0078125,
// 0.00390625, 0.0078125, 0.0117188, 0.015625, 0.0117188, 0.0078125, 0.00390625 };
//
// filterCoeffs.SetData(filterTmp);
// double filterTmp[] = {
// 0.00390625, 0.0078125, 0.0117188, 0.015625, 0.0117188, 0.0078125, 0.00390625,
// 0.0078125, 0.015625, 0.0234375, 0.03125, 0.0234375, 0.015625, 0.0078125,
// 0.0117188, 0.0234375, 0.0351562, 0.046875, 0.0351562, 0.0234375, 0.0117188,
// 0.015625, 0.03125, 0.046875, 0.0625, 0.046875, 0.03125, 0.015625,
// 0.0117188, 0.0234375, 0.0351562, 0.046875, 0.0351562, 0.0234375, 0.0117188,
// 0.0078125, 0.015625, 0.0234375, 0.03125, 0.0234375, 0.015625, 0.0078125,
// 0.00390625, 0.0078125, 0.0117188, 0.015625, 0.0117188, 0.0078125, 0.00390625 };
//
// filterCoeffs.SetData(filterTmp);
filterCoeffs.Fill(1);
filterCoeffs.Fill(1);
filter->SetXsInput(multiSpectReader->GetOutput());
filter->SetPanInput(panchroReader->GetOutput());
filter->SetRadius(radius);
filter->SetFilter(filterCoeffs);
writer->SetInput( filter->GetOutput() );
writer->SetFileName(output);
writer->Update();
}
catch( itk::ExceptionObject & err )
{
std::cout << "Exception itk::ExceptionObject levee !" << std::endl;
std::cout << err << std::endl;
return EXIT_FAILURE;
}
catch( ... )
{
std::cout << "Exception levee inconnue !" << std::endl;
return EXIT_FAILURE;
}
filter->SetXsInput(multiSpectReader->GetOutput());
filter->SetPanInput(panchroReader->GetOutput());
filter->SetRadius(radius);
filter->SetFilter(filterCoeffs);
writer->SetInput( filter->GetOutput() );
writer->SetFileName(output);
writer->Update();
return EXIT_SUCCESS;
}
......
......@@ -9,11 +9,11 @@
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
......@@ -27,37 +27,20 @@
int otbSimpleRcsPanSharpeningFusionImageFilterNew( int argc, char * argv[] )
{
try
{
const unsigned int Dimension = 2;
typedef double PixelType;
typedef otb::VectorImage<PixelType,Dimension> VectorImageType;
typedef otb::Image<PixelType,Dimension> PanchroImageType;
typedef otb::ImageFileReader<VectorImageType> VectorReaderType;
typedef otb::ImageFileReader<PanchroImageType> ImageReaderType;
typedef otb::SimpleRcsPanSharpeningFusionImageFilter
<PanchroImageType, VectorImageType, VectorImageType> FilterType;
FilterType::Pointer filter = FilterType::New();
}
const unsigned int Dimension = 2;
typedef double PixelType;
catch( itk::ExceptionObject & err )
{
std::cout << "Exception itk::ExceptionObject levee !" << std::endl;
std::cout << err << std::endl;
return EXIT_FAILURE;
}
catch( ... )
{
std::cout << "Exception levee inconnue !" << std::endl;
return EXIT_FAILURE;
}
typedef otb::VectorImage<PixelType,Dimension> VectorImageType;
typedef otb::Image<PixelType,Dimension> PanchroImageType;
typedef otb::ImageFileReader<VectorImageType> VectorReaderType;
typedef otb::ImageFileReader<PanchroImageType> ImageReaderType;
typedef otb::SimpleRcsPanSharpeningFusionImageFilter
<PanchroImageType, VectorImageType, VectorImageType> FilterType;
FilterType::Pointer filter = FilterType::New();
return EXIT_SUCCESS;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment