Commit 52e5d16f authored by Julien Malik's avatar Julien Malik
Browse files

ENH: use the already available MatrixImageFilter

parent aa7100db
......@@ -20,7 +20,7 @@
#include "otbMacro.h"
#include "itkImageToImageFilter.h"
#include "otbMatrixMultiplyImageFilter.h"
#include "otbMatrixImageFilter.h"
#include "otbStreamingStatisticsVectorImageFilter.h"
namespace otb
......@@ -54,8 +54,8 @@ public:
itkTypeMacro(FastICAInternalOptimizerVectorImageFilter, ImageToImageFilter);
/** Dimension */
itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
/** Template parameters typedefs */
typedef TInputImage InputImageType;
......@@ -75,7 +75,7 @@ public:
typedef typename MatrixType::InternalMatrixType InternalMatrixType;
typedef typename InternalMatrixType::element_type MatrixElementType;
typedef MatrixMultiplyImageFilter< TInputImage, TOutputImage, RealType > TransformFilterType;
typedef MatrixImageFilter< TInputImage, TOutputImage > TransformFilterType;
typedef typename TransformFilterType::Pointer TransformFilterPointerType;
typedef double (*ContrastFunctionType) ( double );
......
......@@ -21,7 +21,7 @@
#include "otbMacro.h"
#include "itkImageToImageFilter.h"
#include "otbPCAImageFilter.h"
#include "otbMatrixMultiplyImageFilter.h"
#include "otbMatrixImageFilter.h"
#include "otbStreamingStatisticsVectorImageFilter.h"
#include "otbFastICAInternalOptimizerVectorImageFilter.h"
......@@ -53,8 +53,8 @@ public:
itkTypeMacro(FastICAImageFilter, ImageToImageFilter);
/** Dimension */
itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
typedef Transform::TransformDirection TransformDirectionEnumType;
itkStaticConstMacro(DirectionOfTransformation,TransformDirectionEnumType,TDirectionOfTransformation);
......@@ -73,7 +73,7 @@ public:
typedef typename MatrixType::InternalMatrixType InternalMatrixType;
typedef typename InternalMatrixType::element_type MatrixElementType;
typedef MatrixMultiplyImageFilter< TInputImage, TOutputImage, RealType > TransformFilterType;
typedef MatrixImageFilter< TInputImage, TOutputImage > TransformFilterType;
typedef typename TransformFilterType::Pointer TransformFilterPointerType;
typedef FastICAInternalOptimizerVectorImageFilter< InputImageType, InputImageType >
......
......@@ -21,7 +21,7 @@
#include "otbMacro.h"
#include "itkImageToImageFilter.h"
#include "otbStreamingStatisticsVectorImageFilter.h"
#include "otbMatrixMultiplyImageFilter.h"
#include "otbMatrixImageFilter.h"
#include "otbNormalizeVectorImageFilter.h"
#include "otbPCAImageFilter.h"
......@@ -62,8 +62,8 @@ public:
itkTypeMacro(MNFImageFilter, ImageToImageFilter);
/** Dimension */
itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
typedef Transform::TransformDirection TransformDirectionEnumType;
itkStaticConstMacro(DirectionOfTransformation,TransformDirectionEnumType,TDirectionOfTransformation);
......@@ -83,7 +83,7 @@ public:
typedef typename MatrixType::InternalMatrixType InternalMatrixType;
typedef typename InternalMatrixType::element_type MatrixElementType;
typedef MatrixMultiplyImageFilter< InputImageType, OutputImageType, RealType > TransformFilterType;
typedef MatrixImageFilter< InputImageType, OutputImageType > TransformFilterType;
typedef typename TransformFilterType::Pointer TransformFilterPointerType;
typedef TNoiseImageFilter NoiseImageFilterType;
......
......@@ -18,11 +18,6 @@
#ifndef __otbNAPCAImageFilter_h
#define __otbNAPCAImageFilter_h
#include "otbMacro.h"
#include "itkImageToImageFilter.h"
#include "otbStreamingStatisticsVectorImageFilter.h"
#include "otbMatrixMultiplyImageFilter.h"
#include "otbNormalizeVectorImageFilter.h"
#include "otbMNFImageFilter.h"
namespace otb {
......
......@@ -21,7 +21,7 @@
#include "otbMacro.h"
#include "itkImageToImageFilter.h"
#include "otbStreamingStatisticsVectorImageFilter.h"
#include "otbMatrixMultiplyImageFilter.h"
#include "otbMatrixImageFilter.h"
#include "otbNormalizeVectorImageFilter.h"
......@@ -60,8 +60,8 @@ public:
itkTypeMacro(PCAImageFilter, ImageToImageFilter);
/** Dimension */
itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
typedef Transform::TransformDirection TransformDirectionEnumType;
itkStaticConstMacro(DirectionOfTransformation,TransformDirectionEnumType,TDirectionOfTransformation);
......@@ -81,11 +81,11 @@ public:
typedef typename MatrixType::InternalMatrixType InternalMatrixType;
typedef typename InternalMatrixType::element_type MatrixElementType;
typedef MatrixMultiplyImageFilter< TInputImage, TOutputImage, RealType > TransformFilterType;
typedef typename TransformFilterType::Pointer TransformFilterPointerType;
typedef MatrixImageFilter< TInputImage, TOutputImage > TransformFilterType;
typedef typename TransformFilterType::Pointer TransformFilterPointerType;
typedef NormalizeVectorImageFilter< TInputImage, TOutputImage > NormalizeFilterType;
typedef typename NormalizeFilterType::Pointer NormalizeFilterPointerType;
typedef typename NormalizeFilterType::Pointer NormalizeFilterPointerType;
/**
* Set/Get the number of required largest principal components.
......
......@@ -25,7 +25,7 @@
#include "itkAbsImageFilter.h"
#include "otbDotProductImageFilter.h"
#include "otbProjectiveProjectionImageFilter.h"
#include "otbMatrixMultiplyImageFilter.h"
#include "otbMatrixImageFilter.h"
#include "otbVectorImageToMatrixImageFilter.h"
#include "otbStreamingMinMaxImageFilter.h"
#include "otbStreamingStatisticsImageFilter.h"
......@@ -76,7 +76,7 @@ public:
typedef itk::AbsImageFilter<ImageType, ImageType> AbsImageFilterType;
typedef otb::ProjectiveProjectionImageFilter<VectorImageType,VectorImageType,PrecisionType> ProjectiveProjectionImageFilterType;
typedef otb::DotProductImageFilter<VectorImageType,ImageType> DotProductImageFilterType;
typedef otb::MatrixMultiplyImageFilter<VectorImageType,VectorImageType,PrecisionType> MatrixMultiplyImageFilterType;
typedef otb::MatrixImageFilter<VectorImageType,VectorImageType> MatrixImageFilterType;
typedef otb::VectorImageToMatrixImageFilter<VectorImageType> VectorImageToMatrixImageFilterType;
typedef otb::StreamingMinMaxImageFilter<ImageType> StreamingMinMaxImageFilterType;
typedef otb::StreamingStatisticsVectorImageFilter<VectorImageType,PrecisionType> StreamingStatisticsVectorImageFilterType;
......
......@@ -129,7 +129,7 @@ void VCAImageFilter<TImage>::GenerateData()
otbMsgDevMacroVCA( "Apply dimensionality reduction" )
// Xd = Ud.'*M;
typename MatrixMultiplyImageFilterType::Pointer mulUd = MatrixMultiplyImageFilterType::New();
typename MatrixImageFilterType::Pointer mulUd = MatrixImageFilterType::New();
mulUd->SetInput(this->GetInput());
mulUd->SetMatrix(UdT);
mulUd->UpdateOutputInformation();
......@@ -178,7 +178,7 @@ void VCAImageFilter<TImage>::GenerateData()
Ud = U.get_n_columns(0, m_NumberOfEndmembers - 1);
vnl_matrix<PrecisionType> UdT = Ud.transpose();
typename MatrixMultiplyImageFilterType::Pointer mulUd = MatrixMultiplyImageFilterType::New();
typename MatrixImageFilterType::Pointer mulUd = MatrixImageFilterType::New();
mulUd->SetInput(normalize->GetOutput());
mulUd->SetMatrix(UdT);
mulUd->UpdateOutputInformation();
......
......@@ -33,12 +33,12 @@ int otbMNFImageFilterNewTest ( int argc, char* argv[] )
typedef otb::VectorImage< PixelType, Dimension > ImageType;
typedef otb::LocalActivityVectorImageFilter< ImageType, ImageType > NoiseFilterType;
typedef otb::MNFImageFilter< ImageType, ImageType,
typedef otb::MNFImageFilter< ImageType, ImageType,
NoiseFilterType, otb::Transform::FORWARD > FilterType;
FilterType::Pointer filter = FilterType::New();
typedef otb::MNFImageFilter< ImageType, ImageType,
typedef otb::MNFImageFilter< ImageType, ImageType,
NoiseFilterType, otb::Transform::INVERSE > InvFilterType;
InvFilterType::Pointer invFilter = InvFilterType::New();
......@@ -57,11 +57,11 @@ int otbMNFImageFilterTest ( int argc, char* argv[] )
parser->AddOption( "--Normalize", "center and reduce data before MNF", "-norm", 0, false );
parser->AddOutputImage();
typedef otb::CommandLineArgumentParseResult ParserResultType;
typedef otb::CommandLineArgumentParseResult ParserResultType;
ParserResultType::Pointer parseResult = ParserResultType::New();
try
{
{
parser->ParseCommandLine( argc, argv, parseResult );
}
catch( itk::ExceptionObject & err )
......@@ -105,7 +105,7 @@ int otbMNFImageFilterTest ( int argc, char* argv[] )
NoiseFilterType::RadiusType radius = {{ radiusX, radiusY }};
// Image filtering
typedef otb::MNFImageFilter< ImageType, ImageType,
typedef otb::MNFImageFilter< ImageType, ImageType,
NoiseFilterType, otb::Transform::FORWARD > FilterType;
FilterType::Pointer filter = FilterType::New();
filter->SetInput( reader->GetOutput() );
......@@ -127,7 +127,7 @@ int otbMNFImageFilterTest ( int argc, char* argv[] )
if ( parseResult->IsOptionPresent("--Inverse") )
{
typedef otb::MNFImageFilter< ImageType, ImageType,
typedef otb::MNFImageFilter< ImageType, ImageType,
NoiseFilterType, otb::Transform::INVERSE > InvFilterType;
InvFilterType::Pointer invFilter = InvFilterType::New();
invFilter->SetInput( filter->GetOutput() );
......@@ -139,7 +139,7 @@ int otbMNFImageFilterTest ( int argc, char* argv[] )
typedef otb::CommandProgressUpdate< InvFilterType > CommandType2;
CommandType2::Pointer invObserver = CommandType2::New();
invFilter->AddObserver( itk::ProgressEvent(), invObserver );
ImageWriterType::Pointer invWriter = ImageWriterType::New();
invWriter->SetFileName( parseResult->GetParameterString("--Inverse") );
invWriter->SetInput( invFilter->GetOutput() );
......@@ -149,7 +149,3 @@ int otbMNFImageFilterTest ( int argc, char* argv[] )
return EXIT_SUCCESS;
}
......@@ -22,7 +22,7 @@
#include "otbDotProductImageFilter.h"
#include "otbProjectiveProjectionImageFilter.h"
#include "otbMatrixMultiplyImageFilter.h"
#include "otbMatrixImageFilter.h"
#include "otbVectorImageToMatrixImageFilter.h"
#include "otbStreamingStatisticsImageFilter.h"
#include "otbStreamingStatisticsVectorImageFilter.h"
......@@ -36,7 +36,7 @@ typedef otb::VectorImage<PixelType, Dimension> VectorImageType;
typedef otb::ImageFileReader<VectorImageType> ReaderType;
typedef otb::ProjectiveProjectionImageFilter<VectorImageType,VectorImageType,PrecisionType> ProjectiveProjectionImageFilterType;
typedef otb::DotProductImageFilter<VectorImageType,ImageType> DotProductImageFilterType;
typedef otb::MatrixMultiplyImageFilter<VectorImageType,VectorImageType,PrecisionType> MatrixMultiplyImageFilterType;
typedef otb::MatrixImageFilter<VectorImageType,VectorImageType> MatrixImageFilterType;
typedef otb::VectorImageToMatrixImageFilter<VectorImageType> VectorImageToMatrixImageFilterType;
typedef otb::ImageFileWriter<VectorImageType> WriterType;
typedef otb::StreamingStatisticsVectorImageFilter<VectorImageType> StreamingStatisticsVectorImageFilterType;
......@@ -72,7 +72,7 @@ int otbProjectiveProjectionTestHighSNR(int argc, char * argv[])
std::cout << "Apply dimensionnality reduction" << std::endl;
// Xd = Ud.'*M;
MatrixMultiplyImageFilterType::Pointer mulUd = MatrixMultiplyImageFilterType::New();
MatrixImageFilterType::Pointer mulUd = MatrixImageFilterType::New();
mulUd->SetInput(readerImage->GetOutput());
mulUd->SetMatrix(Ud);
mulUd->UpdateOutputInformation();
......
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