Skip to content
Snippets Groups Projects
Commit b93a751f authored by Charles Peyrega's avatar Charles Peyrega
Browse files

ENH: Classification Map Regularization: only input image type is templated in...

ENH: Classification Map Regularization: only input image type is templated in the declaration of the filtertype in the tests, example and application
parent 08ba59bb
Branches
Tags
No related merge requests found
...@@ -41,14 +41,11 @@ public: ...@@ -41,14 +41,11 @@ public:
itkTypeMacro(ClassificationMapRegularization, otb::Application); itkTypeMacro(ClassificationMapRegularization, otb::Application);
/** Filters typedef */ /** Filters typedef */
typedef unsigned char InputLabelPixelType; typedef UInt8ImageType IOLabelImageType;
typedef UInt8ImageType InputLabelImageType;
typedef UInt8ImageType OutputLabelImageType;
// Neighborhood majority voting filter type // Neighborhood majority voting filter type
typedef otb::NeighborhoodMajorityVotingImageFilter<InputLabelImageType, OutputLabelImageType> NeighborhoodMajorityVotingFilterType; typedef otb::NeighborhoodMajorityVotingImageFilter<IOLabelImageType> NeighborhoodMajorityVotingFilterType;
// Binary ball Structuring Element type // Binary ball Structuring Element type
typedef NeighborhoodMajorityVotingFilterType::KernelType StructuringType; typedef NeighborhoodMajorityVotingFilterType::KernelType StructuringType;
...@@ -153,7 +150,7 @@ private: ...@@ -153,7 +150,7 @@ private:
} }
/** REGULARIZATION OF CLASSIFICATION */ /** REGULARIZATION OF CLASSIFICATION */
SetParameterOutputImage<OutputLabelImageType>("io.out", m_NeighMajVotingFilter->GetOutput()); SetParameterOutputImage<IOLabelImageType>("io.out", m_NeighMajVotingFilter->GetOutput());
}// END DoExecute() }// END DoExecute()
......
...@@ -57,8 +57,7 @@ int main(int argc, char * argv[]) ...@@ -57,8 +57,7 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex // Software Guide : EndLatex
// Software Guide : BeginCodeSnippet // Software Guide : BeginCodeSnippet
typedef unsigned char InputLabelPixelType; typedef unsigned char IOLabelPixelType; // 8 bits
typedef unsigned char OutputLabelPixelType;
const unsigned int Dimension = 2; const unsigned int Dimension = 2;
// Software Guide : EndCodeSnippet // Software Guide : EndCodeSnippet
...@@ -71,8 +70,7 @@ int main(int argc, char * argv[]) ...@@ -71,8 +70,7 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex // Software Guide : EndLatex
// Software Guide : BeginCodeSnippet // Software Guide : BeginCodeSnippet
typedef otb::Image<InputLabelPixelType, Dimension> InputLabelImageType; typedef otb::Image<IOLabelPixelType, Dimension> IOLabelImageType;
typedef otb::Image<OutputLabelPixelType, Dimension> OutputLabelImageType;
// Software Guide : EndCodeSnippet // Software Guide : EndCodeSnippet
...@@ -80,14 +78,17 @@ int main(int argc, char * argv[]) ...@@ -80,14 +78,17 @@ int main(int argc, char * argv[])
// //
// We can now define the type for the neighborhood majority voting filter, // We can now define the type for the neighborhood majority voting filter,
// which is templated over its input and output images types and over its // which is templated over its input and output images types and over its
// structuring element type. // structuring element type. Choosing only the input image type in the template
// of this filter induces that, both input and output images types are the same
// and that the structuring element is a ball
// (\doxygen{itk}{BinaryBallStructuringElement}).
// //
// Software Guide : EndLatex // Software Guide : EndLatex
// Software Guide : BeginCodeSnippet // Software Guide : BeginCodeSnippet
// Neighborhood majority voting filter type // Neighborhood majority voting filter type
typedef otb::NeighborhoodMajorityVotingImageFilter<InputLabelImageType, typedef otb::NeighborhoodMajorityVotingImageFilter<IOLabelImageType>
OutputLabelImageType> NeighborhoodMajorityVotingFilterType; NeighborhoodMajorityVotingFilterType;
// Software Guide : EndCodeSnippet // Software Guide : EndCodeSnippet
...@@ -118,8 +119,8 @@ int main(int argc, char * argv[]) ...@@ -118,8 +119,8 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex // Software Guide : EndLatex
// Software Guide : BeginCodeSnippet // Software Guide : BeginCodeSnippet
typedef otb::ImageFileReader<InputLabelImageType> ReaderType; typedef otb::ImageFileReader<IOLabelImageType> ReaderType;
typedef otb::ImageFileWriter<OutputLabelImageType> WriterType; typedef otb::ImageFileWriter<IOLabelImageType> WriterType;
// Software Guide : EndCodeSnippet // Software Guide : EndCodeSnippet
...@@ -147,8 +148,8 @@ int main(int argc, char * argv[]) ...@@ -147,8 +148,8 @@ int main(int argc, char * argv[])
std::string KeepOriginalLabelBoolStr = argv[3]; std::string KeepOriginalLabelBoolStr = argv[3];
unsigned int radiusX = atoi(argv[4]); unsigned int radiusX = atoi(argv[4]);
unsigned int radiusY = atoi(argv[5]); unsigned int radiusY = atoi(argv[5]);
OutputLabelPixelType noDataValue = atoi(argv[6]); IOLabelPixelType noDataValue = atoi(argv[6]);
OutputLabelPixelType undecidedValue = atoi(argv[7]); IOLabelPixelType undecidedValue = atoi(argv[7]);
// Software Guide : BeginLatex // Software Guide : BeginLatex
......
...@@ -30,19 +30,17 @@ ...@@ -30,19 +30,17 @@
int otbNeighborhoodMajorityVotingImageFilterTest(int argc, char* argv[]) int otbNeighborhoodMajorityVotingImageFilterTest(int argc, char* argv[])
{ {
typedef unsigned char InputLabelPixelType; // 8 bits typedef unsigned char IOLabelPixelType; // 8 bits
typedef unsigned char OutputLabelPixelType; // 8 bits
const unsigned int Dimension = 2; const unsigned int Dimension = 2;
typedef otb::Image<InputLabelPixelType, Dimension> InputLabelImageType; typedef otb::Image<IOLabelPixelType, Dimension> IOLabelImageType;
typedef otb::Image<OutputLabelPixelType, Dimension> OutputLabelImageType;
typedef otb::ImageFileReader<InputLabelImageType> ReaderType; typedef otb::ImageFileReader<IOLabelImageType> ReaderType;
typedef otb::ImageFileWriter<OutputLabelImageType> WriterType; typedef otb::ImageFileWriter<IOLabelImageType> WriterType;
// Neighborhood majority voting filter type // Neighborhood majority voting filter type
typedef otb::NeighborhoodMajorityVotingImageFilter<InputLabelImageType, OutputLabelImageType> NeighborhoodMajorityVotingFilterType; typedef otb::NeighborhoodMajorityVotingImageFilter<IOLabelImageType> NeighborhoodMajorityVotingFilterType;
// Binary ball Structuring Element type // Binary ball Structuring Element type
typedef NeighborhoodMajorityVotingFilterType::KernelType StructuringType; typedef NeighborhoodMajorityVotingFilterType::KernelType StructuringType;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment