Commit 93bdfab2 authored by Cyrille Valladeau's avatar Cyrille Valladeau

ENH : add test for TSX Brightness + create an extract for full image test

parent f58900a5
......@@ -1052,6 +1052,7 @@ ADD_TEST(raTvTerraSarCalibrationImageFilterTest ${RADIOMETRY_TESTS9}
${TEMP}/raTvTerraSarCalibrationImageFilterTest.tif
)
# ------- TerraSarBrightnessImageFunctor ------------------------------
ADD_TEST(raTvTerraSarBrightnessImageFunctor ${RADIOMETRY_TESTS9}
--compare-ascii ${EPSILON}
......@@ -1083,13 +1084,23 @@ ADD_TEST(raTvTerraSarBrightnessImageFilterTest ${RADIOMETRY_TESTS9}
IF(OTB_DATA_USE_LARGEINPUT)
ADD_TEST(raTvTerraSarBrightnessImageFilterUPSALA ${RADIOMETRY_TESTS9}
--compare-image ${EPSILON}
${BASELINE}//raTvTerraSarBrightnessImageFilter_UPSALA.tif
${TEMP}//raTvTerraSarBrightnessImageFilter_UPSALA.tif
${BASELINE}/raTvTerraSarBrightnessImageFilter_UPSALA.tif
${TEMP}/raTvTerraSarBrightnessImageFilter_UPSALA.tif
otbTerraSarBrightnessImageFilterTest
${LARGEINPUT}/TERRASARX/UPSALA_GLACIER/TSX1_SAR__MGD/IMAGEDATA/IMAGE_HH_SRA_strip_012.tif
${TEMP}/raTvTerraSarBrightnessImageFilter_UPSALA.tif
0 # don't set calfactor
)
ADD_TEST(raTvTerraSarBrightnessImageFilterTORONTO ${RADIOMETRY_TESTS9}
--compare-image ${EPSILON}
${BASELINE}/raTvTerraSarBrightnessImageFilter_TORONTO.tif
${TEMP}/raTvTerraSarBrightnessImageFilter_TORONTO.tif
otbTerraSarBrightnessImageFilterTest
${LARGEINPUT}/TERRASARX/TORONTO/TSX1_SAR__SSC/IMAGEDATA/IMAGE_HH_SRA_spot_074.cos
${TEMP}/raTvTerraSarBrightnessImageFilter_TORONTO.tif
0 # don't set calfactor
)
ENDIF(OTB_DATA_USE_LARGEINPUT)
......
......@@ -19,6 +19,7 @@
#include "otbTerraSarBrightnessImageFilter.h"
#include "otbImage.h"
#include "itkExtractImageFilter.h"
#include "otbImageFileReader.h"
#include "otbImageFileWriter.h"
......@@ -27,30 +28,47 @@ int otbTerraSarBrightnessImageFilterTest(int argc, char * argv[])
{
const char * inputFileName = argv[1];
const char * outputFileName = argv[2];
bool useMetadata = true;
if(atoi(argv[3]) != 1)
useMetadata = true;
typedef otb::Image<double, 2> ImageType;
typedef otb::ImageFileReader<ImageType> ReaderType;
typedef otb::ImageFileWriter<ImageType> WriterType;
typedef otb::TerraSarBrightnessImageFilter<ImageType, ImageType> FilterType;
typedef itk::ExtractImageFilter<ImageType, ImageType> ExtractorType;
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
FilterType::Pointer filter = FilterType::New();
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
FilterType::Pointer filter = FilterType::New();
ExtractorType::Pointer extractor = ExtractorType::New();
reader->SetFileName(inputFileName);
writer->SetFileName(outputFileName);
reader->UpdateOutputInformation();
//std::cout<<reader->GetOutput()->GetNumberOfComponentsPerPixel()<<std::endl;
if( atoi(argv[3]) == 1 )
filter->SetCalFactor( 10 );
filter->SetInput(reader->GetOutput());
writer->SetInput(filter->GetOutput());
if( useMetadata )
{
// Generate an extract from the large input
ImageType::RegionType region;
ImageType::IndexType id;
id[0] = 50; id[1] = 100;
ImageType::SizeType size;
size[0] = 150; size[1] = 100;
region.SetIndex(id);
region.SetSize(size);
extractor->SetExtractionRegion(region);
extractor->SetInput(filter->GetOutput());
writer->SetInput(extractor->GetOutput());
}
else
{
filter->SetCalFactor( 10 );
writer->SetInput(filter->GetOutput());
}
writer->Update();
......
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