Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Main Repositories
otb
Commits
e7ea3f50
Commit
e7ea3f50
authored
Oct 17, 2011
by
Cyrille Valladeau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH: correct trouble with not exported template methods
parent
d5e2970c
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
181 additions
and
177 deletions
+181
-177
Applications/Classification/CMakeLists.txt
Applications/Classification/CMakeLists.txt
+1
-1
Applications/Classification/otbImageSVMClassifier.cxx
Applications/Classification/otbImageSVMClassifier.cxx
+5
-10
Applications/Classification/otbKMeansClassification.cxx
Applications/Classification/otbKMeansClassification.cxx
+9
-18
Applications/FeatureExtraction/otbLineSegmentDetection.cxx
Applications/FeatureExtraction/otbLineSegmentDetection.cxx
+0
-7
Applications/Hyperspectral/otbHyperspectralUnmixing.cxx
Applications/Hyperspectral/otbHyperspectralUnmixing.cxx
+4
-25
Applications/Util/otbConvert.cxx
Applications/Util/otbConvert.cxx
+7
-16
Applications/Util/otbMultiResolutionPyramid.cxx
Applications/Util/otbMultiResolutionPyramid.cxx
+2
-5
Code/ApplicationEngine/otbWrapperApplication.cxx
Code/ApplicationEngine/otbWrapperApplication.cxx
+2
-0
Code/ApplicationEngine/otbWrapperApplication.h
Code/ApplicationEngine/otbWrapperApplication.h
+80
-13
Code/ApplicationEngine/otbWrapperApplication.txx
Code/ApplicationEngine/otbWrapperApplication.txx
+0
-59
Code/ApplicationEngine/otbWrapperInputImageParameter.cxx
Code/ApplicationEngine/otbWrapperInputImageParameter.cxx
+38
-17
Code/ApplicationEngine/otbWrapperInputImageParameter.h
Code/ApplicationEngine/otbWrapperInputImageParameter.h
+33
-6
No files found.
Applications/Classification/CMakeLists.txt
View file @
e7ea3f50
...
...
@@ -8,4 +8,4 @@ OTB_CREATE_APPLICATION(NAME ImageSVMClassifier
OTB_CREATE_APPLICATION
(
NAME KMeansClassification
SOURCES otbKMeansClassification.cxx
LINK_LIBRARIES OTB
BasicFilters
)
LINK_LIBRARIES OTB
IO;OTBCommon;OTBBasicFilters;OTBFeatureExtraction;OTBLearning
)
Applications/Classification/otbImageSVMClassifier.cxx
View file @
e7ea3f50
...
...
@@ -62,9 +62,9 @@ public:
// Cast filter
// TODO: supress that !!
typedef
MultiToMonoChannelExtractROI
<
FloatVectorImageType
::
InternalPixelType
,
UInt8ImageType
::
PixelType
>
ExtractImageFilterType
;
typedef
ImageToVectorImageCastFilter
<
UInt8ImageType
,
FloatVectorImageType
>
CastImageFilterType
;
//
typedef MultiToMonoChannelExtractROI<FloatVectorImageType::InternalPixelType,
//
UInt8ImageType::PixelType> ExtractImageFilterType;
//
typedef ImageToVectorImageCastFilter<UInt8ImageType, FloatVectorImageType> CastImageFilterType;
private:
ImageSVMClassifier
()
...
...
@@ -153,13 +153,9 @@ private:
{
otbAppLogINFO
(
"Using input mask"
);
// Load mask image and cast into LabeledImageType
FloatVectorImageType
::
Pointer
inMask
=
GetParameterImage
(
"mask"
);
m_Extract
=
ExtractImageFilterType
::
New
();
m_Extract
->
SetInput
(
inMask
);
m_Extract
->
SetChannel
(
1
);
m_Extract
->
UpdateOutputInformation
();
UInt8ImageType
::
Pointer
inMask
=
GetParameterUInt8Image
(
"mask"
);
m_ClassificationFilter
->
SetInputMask
(
m_Extract
->
GetOutput
()
);
m_ClassificationFilter
->
SetInputMask
(
inMask
);
}
SetParameterOutputImage
<
UInt8ImageType
>
(
"out"
,
m_ClassificationFilter
->
GetOutput
());
...
...
@@ -168,7 +164,6 @@ private:
ClassificationFilterType
::
Pointer
m_ClassificationFilter
;
ModelPointerType
m_ModelSVM
;
RescalerType
::
Pointer
m_Rescaler
;
ExtractImageFilterType
::
Pointer
m_Extract
;
};
...
...
Applications/Classification/otbKMeansClassification.cxx
View file @
e7ea3f50
...
...
@@ -30,35 +30,28 @@
#include "itkWeightedCentroidKdTreeGenerator.h"
#include "itkKdTreeBasedKmeansEstimator.h"
#include "itkMersenneTwisterRandomVariateGenerator.h"
#include "itkCastImageFilter.h"
#include "otbMultiToMonoChannelExtractROI.h"
namespace
otb
{
namespace
Wrapper
{
typedef
otb
::
Image
<
FloatVectorImageType
::
InternalPixelType
,
2
>
ImageReaderType
;
typedef
UInt8ImageType
LabeledImageType
;
typedef
ImageReaderType
::
PixelType
PixelType
;
typedef
FloatImageType
::
PixelType
PixelType
;
typedef
itk
::
FixedArray
<
PixelType
,
108
>
SampleType
;
typedef
itk
::
Statistics
::
ListSample
<
SampleType
>
ListSampleType
;
typedef
itk
::
Statistics
::
WeightedCentroidKdTreeGenerator
<
ListSampleType
>
TreeGeneratorType
;
typedef
TreeGeneratorType
::
KdTreeType
TreeType
;
typedef
itk
::
Statistics
::
KdTreeBasedKmeansEstimator
<
TreeType
>
EstimatorType
;
typedef
itk
::
CastImageFilter
<
FloatImageListType
,
FloatImageType
>
CastMaskFilterType
;
typedef
otb
::
MultiToMonoChannelExtractROI
<
FloatVectorImageType
::
InternalPixelType
,
LabeledImageType
::
InternalPixelType
>
ExtractorType
;
typedef
otb
::
StreamingTraits
<
FloatVectorImageType
>
StreamingTraitsType
;
typedef
itk
::
ImageRegionSplitter
<
2
>
SplitterType
;
typedef
Image
Reader
Type
::
RegionType
RegionType
;
typedef
Float
ImageType
::
RegionType
RegionType
;
typedef
itk
::
ImageRegionConstIterator
<
FloatVectorImageType
>
IteratorType
;
typedef
itk
::
ImageRegionConstIterator
<
Labeled
ImageType
>
LabeledIteratorType
;
typedef
itk
::
ImageRegionConstIterator
<
UInt8
ImageType
>
LabeledIteratorType
;
typedef
otb
::
KMeansImageClassificationFilter
<
FloatVectorImageType
,
Labeled
ImageType
,
108
>
ClassificationFilterType
;
typedef
otb
::
KMeansImageClassificationFilter
<
FloatVectorImageType
,
UInt8
ImageType
,
108
>
ClassificationFilterType
;
class
KMeansClassification
:
public
Application
{
...
...
@@ -116,12 +109,11 @@ private:
itk
::
Statistics
::
MersenneTwisterRandomVariateGenerator
::
Pointer
randomGen
=
itk
::
Statistics
::
MersenneTwisterRandomVariateGenerator
::
New
();
m_InImage
=
GetParameterImage
(
"in"
);
m_Extractor
=
ExtractorType
::
New
();
m_Extractor
->
SetInput
(
GetParameterImage
(
"vm"
));
m_Extractor
->
SetChannel
(
1
);
m_Extractor
->
UpdateOutputInformation
();
LabeledImageType
::
Pointer
maskImage
=
m_Extractor
->
GetOutput
();
std
::
cout
<<
"mask in progress"
<<
std
::
endl
;
UInt8ImageType
::
Pointer
maskImage
=
GetParameterUInt8Image
(
"vm"
);
std
::
cout
<<
"mask in progress done"
<<
std
::
endl
;
std
::
ostringstream
message
(
""
);
const
unsigned
int
nbsamples
=
GetParameterInt
(
"ts"
);
...
...
@@ -331,11 +323,10 @@ private:
m_Classifier
->
SetCentroids
(
estimator
->
GetParameters
());
SetParameterOutputImage
<
Labeled
ImageType
>
(
"out"
,
m_Classifier
->
GetOutput
());
SetParameterOutputImage
<
UInt8
ImageType
>
(
"out"
,
m_Classifier
->
GetOutput
());
}
ExtractorType
::
Pointer
m_Extractor
;
ClassificationFilterType
::
Pointer
m_Classifier
;
FloatVectorImageType
::
Pointer
m_InImage
;
...
...
Applications/FeatureExtraction/otbLineSegmentDetection.cxx
View file @
e7ea3f50
...
...
@@ -20,13 +20,8 @@
#include "otbStreamingLineSegmentDetector.h"
#include "otbImage.h"
#include "otbVectorImage.h"
#include "otbVectorImageToAmplitudeImageFilter.h"
#include "otbVectorData.h"
#include "otbImageFileReader.h"
#include "otbVectorDataFileWriter.h"
#include "otbStandardFilterWatcher.h"
#include "otbStreamingStatisticsImageFilter.h"
#include "itkShiftScaleImageFilter.h"
...
...
@@ -35,8 +30,6 @@
#include "itkAffineTransform.h"
namespace
otb
{
namespace
Wrapper
...
...
Applications/Hyperspectral/otbHyperspectralUnmixing.cxx
View file @
e7ea3f50
...
...
@@ -30,17 +30,12 @@
#include "otbVectorImageToMatrixImageFilter.h"
#include "itkCastImageFilter.h"
namespace
otb
{
namespace
Wrapper
{
typedef
itk
::
CastImageFilter
<
FloatVectorImageType
,
DoubleVectorImageType
>
FloatToDoubleFilterType
;
typedef
itk
::
CastImageFilter
<
DoubleVectorImageType
,
FloatVectorImageType
>
DoubleToFloatFilterType
;
const
unsigned
int
Dimension
=
2
;
typedef
otb
::
StreamingStatisticsVectorImageFilter
<
DoubleVectorImageType
>
StreamingStatisticsVectorImageFilterType
;
...
...
@@ -265,10 +260,7 @@ private:
*
*/
FloatToDoubleFilterType
::
Pointer
cast
=
FloatToDoubleFilterType
::
New
();
cast
->
SetInput
(
GetParameterImage
(
"in"
)
);
DoubleVectorImageType
::
Pointer
inputImage
=
cast
->
GetOutput
();
m_ProcessObjects
.
push_back
(
cast
.
GetPointer
());
DoubleVectorImageType
::
Pointer
inputImage
=
GetParameterImage
<
DoubleVectorImageType
>
(
"in"
);
DoubleVectorImageType
::
Pointer
endmembersImage
;
if
(
inputEndmembers
.
empty
()
)
...
...
@@ -332,11 +324,7 @@ private:
* Read input endmembers
*/
std
::
cout
<<
"Read Endmembers "
<<
inputEndmembers
<<
std
::
endl
;
FloatToDoubleFilterType
::
Pointer
cast
=
FloatToDoubleFilterType
::
New
();
cast
->
SetInput
(
GetParameterImage
(
"ie"
)
);
endmembersImage
=
cast
->
GetOutput
();
m_ProcessObjects
.
push_back
(
cast
.
GetPointer
());
endmembersImage
=
GetParameterImage
<
DoubleVectorImageType
>
(
"ie"
);
}
// endmembersRef->Update();
...
...
@@ -430,12 +418,7 @@ private:
*/
std
::
cout
<<
"Write endmembers "
<<
outputEndmembers
<<
std
::
endl
;
DoubleToFloatFilterType
::
Pointer
cast
=
DoubleToFloatFilterType
::
New
();
cast
->
SetInput
(
endmembersImage
);
FloatVectorImageType
::
Pointer
endmembersImageFloat
=
cast
->
GetOutput
();
m_ProcessObjects
.
push_back
(
cast
.
GetPointer
());
SetParameterOutputImage
(
"oe"
,
endmembersImageFloat
);
SetParameterOutputImage
<
DoubleVectorImageType
>
(
"oe"
,
endmembersImage
);
}
if
(
unmixingAlgo
!=
UnMixingMethod_NONE
)
...
...
@@ -444,12 +427,8 @@ private:
* Write abundance map
*/
//std::cout << "Write abundance map" << outputImageName << std::endl;
DoubleToFloatFilterType
::
Pointer
cast
=
DoubleToFloatFilterType
::
New
();
cast
->
SetInput
(
abundanceMap
);
FloatVectorImageType
::
Pointer
abundanceMapFloat
=
cast
->
GetOutput
();
m_ProcessObjects
.
push_back
(
cast
.
GetPointer
());
SetParameterOutputImage
(
"out"
,
abundanceMap
Float
);
SetParameterOutputImage
<
DoubleVectorImageType
>
(
"out"
,
abundanceMap
);
}
}
...
...
Applications/Util/otbConvert.cxx
View file @
e7ea3f50
...
...
@@ -117,8 +117,7 @@ private:
void
GenericDoExecute
()
{
// Get the input image list
FloatVectorImageType
::
Pointer
input
=
this
->
GetParameterImage
(
"in"
);
input
->
UpdateOutputInformation
();
typename
TImageType
::
Pointer
castIm
;
...
...
@@ -131,14 +130,13 @@ private:
if
(
rescaleType
==
"None"
)
{
typedef
itk
::
CastImageFilter
<
FloatVectorImageType
,
TImageType
>
CastFilterType
;
typename
CastFilterType
::
Pointer
cast
=
CastFilterType
::
New
();
cast
->
SetInput
(
input
);
m_TmpFilter
=
cast
;
castIm
=
cast
->
GetOutput
();
castIm
=
this
->
GetParameterImage
<
TImageType
>
(
"in"
);
}
else
{
FloatVectorImageType
::
Pointer
input
=
this
->
GetParameterImage
(
"in"
);
input
->
UpdateOutputInformation
();
const
unsigned
int
nbComp
(
input
->
GetNumberOfComponentsPerPixel
());
typedef
otb
::
VectorRescaleIntensityImageFilter
<
FloatVectorImageType
,
TImageType
>
RescalerType
;
...
...
@@ -233,14 +231,8 @@ private:
castIm
=
rescaler
->
GetOutput
();
}
typedef
itk
::
CastImageFilter
<
TImageType
,
FloatVectorImageType
>
EndCastFilterType
;
typename
EndCastFilterType
::
Pointer
endCast
=
EndCastFilterType
::
New
();
endCast
->
SetInput
(
castIm
);
endCast
->
UpdateOutputInformation
();
m_FinalCaster
=
endCast
;
SetParameterOutputImage
(
"out"
,
endCast
->
GetOutput
());
SetParameterOutputImage
<
TImageType
>
(
"out"
,
castIm
);
}
...
...
@@ -278,7 +270,6 @@ private:
}
}
itk
::
ProcessObject
::
Pointer
m_FinalCaster
;
itk
::
ProcessObject
::
Pointer
m_TmpFilter
;
TransferLogType
::
Pointer
m_TransferLog
;
};;
...
...
Applications/Util/otbMultiResolutionPyramid.cxx
View file @
e7ea3f50
...
...
@@ -18,8 +18,6 @@
#include "otbWrapperApplication.h"
#include "otbWrapperApplicationFactory.h"
#include "otbImage.h"
#include "otbVectorImage.h"
#include "otbPerBandVectorImageFilter.h"
#include "itkDiscreteGaussianImageFilter.h"
#include "itkShrinkImageFilter.h"
...
...
@@ -53,9 +51,8 @@ public:
itkTypeMacro
(
MultiResolutionPyramid
,
otb
::
Application
);
/** Image and filters typedef */
typedef
otb
::
Image
<
float
>
SingleImageType
;
typedef
itk
::
DiscreteGaussianImageFilter
<
SingleImageType
,
SingleImageType
>
SmoothingImageFilterType
;
typedef
itk
::
DiscreteGaussianImageFilter
<
FloatImageType
,
FloatImageType
>
SmoothingImageFilterType
;
typedef
otb
::
PerBandVectorImageFilter
<
FloatVectorImageType
,
FloatVectorImageType
,
...
...
Code/ApplicationEngine/otbWrapperApplication.cxx
View file @
e7ea3f50
...
...
@@ -37,6 +37,8 @@
#include "otbWrapperAddProcessToWatchEvent.h"
#include "otbWrapperTypes.h"
namespace
otb
{
namespace
Wrapper
...
...
Code/ApplicationEngine/otbWrapperApplication.h
View file @
e7ea3f50
...
...
@@ -30,6 +30,7 @@
#include "otbWrapperMacros.h"
#include "otbWrapperTypes.h"
#include "otbWrapperOutputImageParameter.h"
#include "otbWrapperInputImageParameter.h"
namespace
otb
{
...
...
@@ -216,14 +217,6 @@ public:
*/
void
SetParameterOutputImage
(
std
::
string
parameter
,
FloatVectorImageType
*
value
);
/* Set an output image value
*
* Can be called for types :
* \li ParameterType_OutputImage
*/
template
<
class
TImageType
>
void
SetParameterOutputImage
(
std
::
string
parameter
,
TImageType
*
value
);
/* Set the pixel type in which the image will be saved
*
* Can be called for types :
...
...
@@ -289,8 +282,45 @@ public:
* Can be called for types :
* \li ParameterType_InputImage
*/
template
<
class
TImageType
>
TImageType
*
GetParameterImage
(
std
::
string
parameter
);
#define otbGetParameterImageMacro( Image ) \
Image##Type * GetParameter##Image( std::string parameter ) \
{ \
Image##Type::Pointer ret; \
Parameter* param = GetParameterByKey(parameter); \
if (dynamic_cast<InputImageParameter*>(param)) \
{ \
InputImageParameter* paramDown = dynamic_cast<InputImageParameter*>(param); \
ret = paramDown->Get##Image(); \
} \
return ret; \
}
otbGetParameterImageMacro
(
UInt8Image
);
otbGetParameterImageMacro
(
Int8Image
);
otbGetParameterImageMacro
(
UInt16Image
);
otbGetParameterImageMacro
(
Int16Image
);
otbGetParameterImageMacro
(
UInt32Image
);
otbGetParameterImageMacro
(
Int32Image
);
otbGetParameterImageMacro
(
FloatImage
);
otbGetParameterImageMacro
(
DoubleImage
);
otbGetParameterImageMacro
(
UInt8VectorImage
);
otbGetParameterImageMacro
(
Int8VectorImage
);
otbGetParameterImageMacro
(
UInt16VectorImage
);
otbGetParameterImageMacro
(
Int16VectorImage
);
otbGetParameterImageMacro
(
UInt32VectorImage
);
otbGetParameterImageMacro
(
Int32VectorImage
);
otbGetParameterImageMacro
(
FloatVectorImage
);
otbGetParameterImageMacro
(
DoubleVectorImage
);
otbGetParameterImageMacro
(
UInt8RGBAImage
);
otbGetParameterImageMacro
(
Int8RGBAImage
);
otbGetParameterImageMacro
(
UInt16RGBAImage
);
otbGetParameterImageMacro
(
Int16RGBAImage
);
otbGetParameterImageMacro
(
UInt32RGBAImage
);
otbGetParameterImageMacro
(
Int32RGBAImage
);
otbGetParameterImageMacro
(
FloatRGBAImage
);
otbGetParameterImageMacro
(
DoubleRGBAImage
);
/* Get an image list value
...
...
@@ -384,6 +414,43 @@ protected:
/* Set the user level of access to a parameter */
void
SetParameterUserLevel
(
std
::
string
paramKey
,
UserLevel
level
);
/* Get an image value
*
* Can be called for types :
* \li ParameterType_InputImage
*/
template
<
class
TImageType
>
TImageType
*
GetParameterImage
(
std
::
string
parameter
)
{
typename
TImageType
::
Pointer
ret
;
Parameter
*
param
=
GetParameterByKey
(
parameter
);
if
(
dynamic_cast
<
InputImageParameter
*>
(
param
))
{
InputImageParameter
*
paramDown
=
dynamic_cast
<
InputImageParameter
*>
(
param
);
ret
=
paramDown
->
GetImage
<
TImageType
>
();
}
//TODO: exception if not found ?
return
ret
;
}
/* Set an output image value
*
* Can be called for types :
* \li ParameterType_OutputImage
*/
template
<
class
TImageType
>
void
SetParameterOutputImage
(
std
::
string
parameter
,
TImageType
*
value
)
{
Parameter
*
param
=
GetParameterByKey
(
parameter
);
if
(
dynamic_cast
<
OutputImageParameter
*>
(
param
))
{
OutputImageParameter
*
paramDown
=
dynamic_cast
<
OutputImageParameter
*>
(
param
);
paramDown
->
SetValue
(
value
);
}
}
private:
/* Implement this method to add parameters */
virtual
void
DoCreateParameters
()
=
0
;
...
...
@@ -412,8 +479,8 @@ private:
}
//end namespace otb
#ifndef OTB_MANUAL_INSTANTIATION
#include "otbWrapperApplication.txx"
#endif
//
#ifndef OTB_MANUAL_INSTANTIATION
//
#include "otbWrapperApplication.txx"
//
#endif
#endif // __otbWrapperApplication_h_
Code/ApplicationEngine/otbWrapperApplication.txx
deleted
100644 → 0
View file @
d5e2970c
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
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.
=========================================================================*/
#include "otbWrapperApplication.h"
#include "otbWrapperOutputImageParameter.h"
#include "otbWrapperInputImageParameter.h"
//#include "otbWrapperParameterGroup.h"
namespace otb
{
namespace Wrapper
{
template <class TImageType>
void Application::SetParameterOutputImage(std::string parameter, TImageType* value)
{
Parameter* param = GetParameterByKey(parameter);
if (dynamic_cast<OutputImageParameter*>(param))
{
OutputImageParameter* paramDown = dynamic_cast<OutputImageParameter*>(param);
paramDown->SetValue(value);
}
}
template <class TImageType>
TImageType* Application::GetParameterImage(std::string parameter)
{
typename TImageType::Pointer ret;
Parameter* param = GetParameterByKey(parameter);
if (dynamic_cast<InputImageParameter*>(param))
{
InputImageParameter* paramDown = dynamic_cast<InputImageParameter*>(param);
ret = paramDown->GetImage<TImageType>();
}
//TODO: exception if not found ?
return ret;
}
}
}
Code/ApplicationEngine/otbWrapperInputImageParameter.cxx
View file @
e7ea3f50
...
...
@@ -29,14 +29,10 @@ namespace Wrapper
InputImageParameter
::
InputImageParameter
()
{
std
::
cout
<<
this
<<
" InputImageParameter::GetImage m_Image.IsNull() "
<<
m_Image
.
IsNull
()
<<
std
::
endl
;
this
->
SetName
(
"Input Image"
);
this
->
SetKey
(
"in"
);
m_FileName
=
""
;
this
->
ClearValue
();
std
::
cout
<<
this
<<
" InputImageParameter::GetImage m_Image.IsNull() "
<<
m_Image
.
IsNull
()
<<
std
::
endl
;
}
InputImageParameter
::~
InputImageParameter
()
...
...
@@ -46,7 +42,6 @@ InputImageParameter::~InputImageParameter()
void
InputImageParameter
::
SetFromFileName
(
const
std
::
string
&
filename
)
{
std
::
cout
<<
this
<<
" InputImageParameter::SetFromFileName"
<<
std
::
endl
;
// First clear previous file choosen
this
->
ClearValue
();
...
...
@@ -72,23 +67,53 @@ InputImageParameter::SetFromFileName(const std::string& filename)
}
FloatVectorImageType
*
InputImageParameter
::
GetImage
()
{
std
::
cout
<<
this
<<
" GetImage<FloatVectorImageType>"
<<
std
::
endl
;
return
this
->
GetImage
<
FloatVectorImageType
>
();
}
#define otbGetImageMacro(image) \
image##Type * \
InputImageParameter::Get##image () \
{ \
return this->GetImage< image##Type > (); \
}
otbGetImageMacro
(
UInt8Image
)
otbGetImageMacro
(
Int8Image
);
otbGetImageMacro
(
UInt16Image
);
otbGetImageMacro
(
Int16Image
);
otbGetImageMacro
(
UInt32Image
);
otbGetImageMacro
(
Int32Image
);
otbGetImageMacro
(
FloatImage
);
otbGetImageMacro
(
DoubleImage
);
otbGetImageMacro
(
UInt8VectorImage
);
otbGetImageMacro
(
Int8VectorImage
);
otbGetImageMacro
(
UInt16VectorImage
);
otbGetImageMacro
(
Int16VectorImage
);
otbGetImageMacro
(
UInt32VectorImage
);
otbGetImageMacro
(
Int32VectorImage
);
otbGetImageMacro
(
FloatVectorImage
);
otbGetImageMacro
(
DoubleVectorImage
);
otbGetImageMacro
(
UInt8RGBAImage
);
otbGetImageMacro
(
Int8RGBAImage
);
otbGetImageMacro
(
UInt16RGBAImage
);
otbGetImageMacro
(
Int16RGBAImage
);
otbGetImageMacro
(
UInt32RGBAImage
);
otbGetImageMacro
(
Int32RGBAImage
);
otbGetImageMacro
(
FloatRGBAImage
);
otbGetImageMacro
(
DoubleRGBAImage
);
template
<
class
TOutputImage
>
TOutputImage
*
InputImageParameter
::
GetImage
()
{
std
::
cout
<<
this
<<
" InputImageParameter::GetImage inside"
<<
std
::
endl
;
std
::
cout
<<
this
<<
" InputImageParameter::GetImage m_FileName "
<<
m_FileName
<<
std
::
endl
;
std
::
cout
<<
this
<<
" InputImageParameter::GetImage m_FileName.empty() "
<<
m_FileName
.
empty
()
<<
std
::
endl
;
std
::
cout
<<
this
<<
" InputImageParameter::GetImage m_Image.IsNull() "
<<
m_Image
.
IsNull
()
<<
std
::
endl
;
// 2 cases : the user set a filename vs. the user set an image
//////////////////////// Filename case:
if
(
!
m_FileName
.
empty
()
)
...
...
@@ -107,14 +132,13 @@ InputImageParameter::GetImage()
m_Image
=
reader
->
GetOutput
();
m_Reader
=
reader
;
// Pay attention, don't return m_Image because it is a ImageBase...
return
reader
->
GetOutput
();
}
//////////////////////// Image case:
else
{
std
::
cout
<<
this
<<
" GetImage<FloatVectorImageType>"
<<
std
::
endl
;
if
(
m_Image
.
IsNull
()
)
{
itkExceptionMacro
(
"No input image or filename detected..."
);
...
...
@@ -224,7 +248,6 @@ InputImageParameter::GetImage()
}
}
std
::
cout
<<
this
<<
" InputImageParameter::GetImage outside"
<<
std
::
endl
;
}
...
...
@@ -1644,8 +1667,7 @@ template <class TInputImage>
void
InputImageParameter
::
SetImage
(
TInputImage
*
image
)
{
std
::
cout
<<
this
<<
" InputImageParameter::SetImage"
<<
std
::
endl
;
m_Image
=
image
;
m_Image
=
image
;
}
...
...
@@ -1661,7 +1683,6 @@ InputImageParameter::HasValue() const
void
InputImageParameter
::
ClearValue
()
{
std
::
cout
<<
this
<<
" InputImageParameter::ClearValue"
<<
std
::
endl
;
m_Image
=
NULL
;
m_Reader
=
NULL
;
m_Caster
=
NULL
;
...
...
Code/ApplicationEngine/otbWrapperInputImageParameter.h
View file @
e7ea3f50
...
...
@@ -51,15 +51,42 @@ public:
void
SetFromFileName
(
const
std
::
string
&
filename
);
itkGetConstMacro
(
FileName
,
std
::
string
);
/** Get the input image as FloatVectorImageType */
/** Get the input image as FloatVectorImageType. */
FloatVectorImageType
*
GetImage
();
/** Get the input image as XXXImageType */
UInt8ImageType
*
GetUInt8Image
();
Int8ImageType
*
GetInt8Image
();