Commit 26816991 authored by Julien Michel's avatar Julien Michel

Merge branch 'develop' into rfc-16-rfconfmap

parents 5006ad48 0c8eab2c
......@@ -18,7 +18,7 @@
#----------------------------------------------------------------------
set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1000000)
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 300)
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 2000)
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 50)
......@@ -45,7 +45,6 @@ set(CTEST_CUSTOM_COVERAGE_EXCLUDE
set(CTEST_CUSTOM_WARNING_EXCEPTION
${CTEST_CUSTOM_WARNING_EXCEPTION}
"vcl_deprecated_header"
"backward_warning"
"warning LNK4221"
"ranlib:.*file:.*has no symbols"
......@@ -64,6 +63,20 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION
# other warning expression:
"[0-9,]+ warnings? generated."
".*include.opencv2.*warning.*"
".*warning:.*deprecated.*"
".*vcl_deprecated_header.*"
".*include.kml.*warning.*"
".*include.ogr_feature.*warning.*"
".*itksys.SharedForward.h.*warning.*"
".*vcl_deprecated_header.h.*"
".*otbCurlHelper.cxx:356.*warning.*maxConnect.*"
".*include.ITK-4.*[Ww]arning.*"
".*include.curl.curl.h.*[Ww]arning.*"
".*include.ossim.*[Ww]arning.*"
".*include.ogr_core.h.*[Ww]arning.*"
".*include.ogr_srs_api.h.*[Ww]arning.*"
".*include.ogrsf_frmts.h.*[Ww]arning.*"
".*include.ogr_geometry.h.*[Ww]arning.*"
".*include.ogr_spatialref.h.*[Ww]arning.*"
".*include.cpl_error.h.*[Ww]arning.*"
".*vnl.vnl_numeric_traits.h.*[Ww]arning.*"
".*vcl_config_compiler.h.*[Ww]arning.*"
)
......@@ -7,6 +7,7 @@ endif()
foreach(p
CMP0025 # CMake 3.0
CMP0042 # CMake 3.0
CMP0058
)
if(POLICY ${p})
cmake_policy(SET ${p} NEW)
......@@ -65,7 +66,7 @@ set(main_project_name ${_OTBModuleMacros_DEFAULT_LABEL})
#-----------------------------------------------------------------------------
# OTB version number.
set(OTB_VERSION_MAJOR "5")
set(OTB_VERSION_MINOR "0")
set(OTB_VERSION_MINOR "2")
set(OTB_VERSION_PATCH "0")
set(OTB_VERSION_STRING "${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}.${OTB_VERSION_PATCH}")
......
......@@ -206,10 +206,10 @@ int main (int argc, char **argv)
= options.workingInplace ? input
: options.outputIsStdout ? 0
: otb::ogr::DataSource::New( options.outputFile, otb::ogr::DataSource::Modes::Update_LayerCreateOnly);
std::cout << "input: " << input -> ogr().GetName() << " should be: " << options.inputFile << "\n";
std::cout << "input: " << otb::ogr::version_proxy::GetFileListAsStringVector(&input->ogr())[0] << " should be: " << options.inputFile << "\n";
if (output)
{
std::cout << "output: " << output -> ogr().GetName() << " should be: " << options.outputFile << "\n";
std::cout << "output: " << otb::ogr::version_proxy::GetFileListAsStringVector(&output->ogr())[0] << " should be: " << options.outputFile << "\n";
}
// std::cout << "\n";
......
......@@ -73,10 +73,10 @@ int main (int argc, char **argv)
= workingInplace ? input
: outputIsStdout ? 0
: otb::ogr::DataSource::New( outputFile, otb::ogr::DataSource::Modes::Update_LayerCreateOnly);
std::cout << "input: " << input -> ogr().GetName() << " should be: " << inputFile << "\n";
std::cout << "input: " << otb::ogr::version_proxy::GetFileListAsStringVector(&input->ogr())[0] << " should be: " << inputFile << "\n";
if (output)
{
std::cout << "output: " << output -> ogr().GetName() << " should be: " << outputFile << "\n";
std::cout << "output: " << otb::ogr::version_proxy::GetFileListAsStringVector(&output->ogr())[0] << " should be: " << outputFile << "\n";
}
// std::cout << "\n";
......
......@@ -21,6 +21,7 @@
#include "otbImage.h"
#include "otbImageFileReader.h"
#include "otbImageFileWriter.h"
#include "itkUnaryFunctorImageFilter.h"
#include "itkRescaleIntensityImageFilter.h"
// Software Guide : BeginCommandLineArgs
......
......@@ -23,6 +23,7 @@
/*===============================[ Includes ]================================*/
/*===========================================================================*/
#include "otbOGRFieldWrapper.h"
#include "otbConfigure.h"
#include <cassert>
#include <vector>
#include <boost/mpl/map.hpp>
......@@ -84,6 +85,10 @@ typedef boost::mpl::map
, pair<char* , int_<OFTString> >
, pair<char const* , int_<OFTString> >
, pair<std::vector<std::string>, int_<OFTStringList> >
#ifdef OTB_USE_GDAL_20
, pair<GIntBig, int_<OFTInteger64> >
, pair<std::vector<GIntBig>, int_<OFTInteger64List> >
#endif
// OFTBinary
// OFTDate
// OFTTime
......@@ -312,6 +317,10 @@ typedef map
, pair<int_<OFTRealList>, MemberContainerGetterPtr<double, &OGRFeature::GetFieldAsDoubleList> >
, pair<int_<OFTString>, MemberGetterPtr<char const*, &OGRFeature::GetFieldAsString, std::string> >
, pair<int_<OFTStringList>, StringListMemberGetterPtr<std::vector<std::string> > >
#ifdef OTB_USE_GDAL_20
, pair<int_<OFTInteger64>, MemberGetterPtr<GIntBig, &OGRFeature::GetFieldAsInteger64> >
, pair<int_<OFTInteger64List>, MemberContainerGetterPtr<GIntBig, &OGRFeature::GetFieldAsInteger64List> >
#endif
> FieldGetters_Map;
/**\ingroup GeometryInternals
......@@ -327,6 +336,10 @@ typedef map
, pair<int_<OFTRealList>, MemberContainerSetterPtr<double, &OGRFeature::SetField> >
, pair<int_<OFTString>, MemberSetterPtr<char const*, &OGRFeature::SetField/*, std::string*/> >
, pair<int_<OFTStringList>, StringListMemberSetterPtr<std::vector<std::string> > >
#ifdef OTB_USE_GDAL_20
, pair<int_<OFTInteger64>, MemberSetterPtr<GIntBig, &OGRFeature::SetField> >
, pair<int_<OFTInteger64List>, MemberContainerSetterPtr<const GIntBig, &OGRFeature::SetField> >
#endif
> FieldSetters_Map;
/**\ingroup GeometryInternals
......
......@@ -126,6 +126,9 @@ namespace version_proxy
*/
GDALDriverType * GetDriverByName(const char * name);
std::string GetDriverNameFromDataSource(const GDALDatasetType * ds);
/**
* Sync dataset to disk.
*
......
......@@ -119,6 +119,11 @@ std::vector<std::string> GetAvailableDriversAsStringVector()
return ret;
}
std::string GetDriverNameFromDataSource(const GDALDatasetType * ds)
{
return std::string(const_cast<GDALDatasetType *>(ds)->GetDriver()->GetName());
}
}
}
} // end namespace
......@@ -152,6 +152,11 @@ std::vector<std::string> GetAvailableDriversAsStringVector()
return ret;
}
std::string GetDriverNameFromDataSource(const GDALDatasetType * ds)
{
return std::string(const_cast<GDALDatasetType *>(ds)->GetDriverName());
}
}
}
} // end namespace
......@@ -78,7 +78,7 @@ private:
AddParameter(ParameterType_OutputImage, "io.out", "Output regularized image");
SetParameterDescription( "io.out", "The output regularized labeled image.");
SetParameterOutputImagePixelType( "io.out", ImagePixelType_uint8);
SetDefaultOutputPixelType( "io.out", ImagePixelType_uint8);
AddParameter(ParameterType_Group,"ip","Regularization parameters");
......
......@@ -156,6 +156,7 @@ private:
AddParameter(ParameterType_OutputImage,"out","The output classification image");
SetParameterDescription("out","The output classification image resulting from the fusion of the input classification images.");
SetDefaultOutputPixelType("out",ImagePixelType_uint8);
// Doc example parameter settings
SetDocExampleParameterValue("il", "classification1.tif classification2.tif classification3.tif");
......
......@@ -93,7 +93,7 @@ private:
AddParameter(ParameterType_OutputImage, "out", "Output Image");
SetParameterDescription( "out", "Output image containing class labels");
SetParameterOutputImagePixelType( "out", ImagePixelType_uint8);
SetDefaultOutputPixelType( "out", ImagePixelType_uint8);
AddParameter(ParameterType_OutputImage, "confmap", "Confidence map");
SetParameterDescription( "confmap", "Confidence map of the produced classification. The confidence index depends on the model : \n"
......@@ -107,7 +107,7 @@ private:
" * NormalBayes : (not supported)\n"
" * RandomForest : proportion of decision trees that classified the sample to the second class (only works for 2-class models)\n"
" * SVM : distance to margin (only works for 2-class models)\n");
SetParameterOutputImagePixelType( "confmap", ImagePixelType_double);
SetDefaultOutputPixelType( "confmap", ImagePixelType_double);
MandatoryOff("confmap");
AddRAMParameter();
......
......@@ -181,6 +181,7 @@ private:
SetParameterDescription("in", "Input image to classify.");
AddParameter(ParameterType_OutputImage, "out", "Output Image");
SetParameterDescription("out", "Output image containing the class indexes.");
SetDefaultOutputPixelType("out",ImagePixelType_uint8);
AddRAMParameter();
......
......@@ -87,6 +87,7 @@ private:
AddParameter(ParameterType_OutputImage, "out", "OutputImage");
SetParameterDescription("out", "Output classified image (each pixel contains the index of its corresponding vector in the SOM).");
SetDefaultOutputPixelType("out",ImagePixelType_uint8);
AddParameter(ParameterType_InputImage, "vm", "ValidityMask");
SetParameterDescription("vm", "Validity mask (only pixels corresponding to a mask value greater than 0 will be used for learning)");
......
......@@ -291,6 +291,7 @@ private:
SetParameterDescription("in", "Input image filename");
AddParameter(ParameterType_OutputImage, "out", "Output Image");
SetParameterDescription("out","Output image filename");
SetDefaultOutputPixelType("out",ImagePixelType_uint8);
AddRAMParameter();
......
......@@ -165,10 +165,12 @@ private:
AddParameter(ParameterType_OutputImage, "outgt", "Colored ground truth output");
SetParameterDescription( "outgt", "The colored ground truth output image." );
SetDefaultOutputPixelType("outgt",ImagePixelType_uint8);
MandatoryOff("outgt");
AddParameter(ParameterType_OutputImage, "outms", "Colored machine segmentation output");
SetParameterDescription( "outms", "The colored machine segmentation output image." );
SetDefaultOutputPixelType("outms",ImagePixelType_uint8);
MandatoryOff("outms");
// TODO : add color settings ?
......
......@@ -225,6 +225,7 @@ private:
AddParameter(ParameterType_OutputImage, "out", "Output Image");
SetParameterDescription( "out", "The output image. The output image is the segmentation of the filtered image. It is recommended to set the pixel type to uint32." );
SetDefaultOutputPixelType("out",ImagePixelType_uint32);
AddParameter(ParameterType_Float, "ranger", "Range radius");
SetParameterDescription("ranger", "Range radius defining the radius (expressed in radiometry unit) in the multi-spectral space.");
......
......@@ -90,6 +90,7 @@ private:
AddParameter(ParameterType_OutputImage, "out", "Output Image");
SetParameterDescription( "out", "The output image. The output image is the input image where the minimal regions have been merged." );
SetDefaultOutputPixelType("out",ImagePixelType_uint32);
AddParameter(ParameterType_Int, "minsize", "Minimum Region Size");
SetParameterDescription("minsize", "Minimum Region Size. If, after the segmentation, a region is of size lower than this criterion, the region is merged with the \"nearest\" region (radiometrically).");
......
......@@ -251,6 +251,7 @@ private:
//Raster mode parameters
AddParameter(ParameterType_OutputImage, "mode.raster.out", "Output labeled image");
SetParameterDescription( "mode.raster.out", "The output labeled image.");
SetDefaultOutputPixelType("mode.raster.out",ImagePixelType_uint32);
//Streaming vectorization parameters
AddParameter(ParameterType_OutputFilename, "mode.vector.out", "Output vector file");
......@@ -676,7 +677,7 @@ private:
//Note : the GetDriver() Method has not been encapsulated in otb::ogr::DataSource,
//so we must access the OGR pointer by using .ogr()
std::string driverName(ogrDS->ogr().GetDriver()->GetName());
std::string driverName(otb::ogr::version_proxy::GetDriverNameFromDataSource(&ogrDS->ogr()));
if ( driverName.find("ESRI Shapefile") != std::string::npos)
{
otbAppLogINFO(<<"REPACK the Shapefile ..."<<std::endl);
......
......@@ -155,6 +155,7 @@ private:
AddParameter(ParameterType_OutputImage, "io.outmask", "The output mask corresponding to all criterions");
SetParameterDescription("io.outmask","A mask image corresponding to all citerions (see masking parameters). Only required if variance threshold or nodata criterions are set.");
SetDefaultOutputPixelType("io.outmask",ImagePixelType_uint8);
DisableParameter("io.outmask");
MandatoryOff("io.outmask");
......
......@@ -4,6 +4,8 @@ otb_module(OTBCommon
DEPENDS
OTBBoost
OTBITK
#Add dependency to OTBGDAL as GDAL module need to set OTB_USE_GDAL_20 before configuring otbConfigure.h
OTBGDAL
TEST_DEPENDS
OTBImageBase
......
......@@ -21,6 +21,7 @@
#include "otbVectorDataKeywordlist.h"
#include "otbConfigure.h"
#include "itkNumericTraits.h"
namespace otb
{
......
......@@ -375,7 +375,7 @@ void MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIt
neighborhoodRegion.SetSize(regionSize);
RealType weightSum = 0;
RealVector jointNeighbor(ImageDimension + m_NumberOfComponentsPerPixel), shifts(ImageDimension + m_NumberOfComponentsPerPixel);
RealVector shifts(jointDimension);
// An iterator on the neighborhood of the current pixel (in joint
// spatial-range domain)
......@@ -385,7 +385,7 @@ void MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIt
it.GoToBegin();
while (!it.IsAtEnd())
{
jointNeighbor = it.Get();
const RealType *jointNeighbor = it.GetPixelPointer();
// Compute the squared norm of the difference
// This is the L2 norm, TODO: replace by the templated norm
......@@ -393,7 +393,7 @@ void MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIt
for (unsigned int comp = 0; comp < jointDimension; comp++)
{
shifts[comp] = jointNeighbor[comp] - jointPixel[comp];
double d = shifts[comp]/bandwidth[comp];
double d = shifts[comp] / bandwidth[comp];
norm2 += d*d;
}
......@@ -554,7 +554,7 @@ void MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIt
typename OutputImageType::PixelType rangePixel(m_NumberOfComponentsPerPixel);
typename OutputSpatialImageType::PixelType spatialPixel(ImageDimension);
RealVector jointPixel;
RealVector jointPixel(jointDimension);
RealVector bandwidth(jointDimension);
for (unsigned int comp = 0; comp < ImageDimension; comp++)
......@@ -612,7 +612,9 @@ void MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIt
// get input pixel in the joint spatial-range domain (with components
// normalized by bandwith)
jointPixel = jointIt.Get(); // Pixel in the joint spatial-range domain
const RealVector &jointPixelVal = jointIt.Get(); // Pixel in the joint spatial-range domain
for (unsigned int comp = 0; comp < jointDimension; comp++)
jointPixel[comp] = jointPixelVal[comp];
for (unsigned int comp = ImageDimension; comp < jointDimension; comp++)
bandwidth[comp] = m_RangeBandwidthRamp*jointPixel[comp]+m_RangeBandwidth;
......
......@@ -1092,7 +1092,7 @@ int TestHelper::RegressionTestOgrFile(const char *testOgrFilename, const char *b
test_poDS = otb::ogr::version_proxy::Open(ref_pszDataSource, bReadOnly);
bReadOnly = TRUE;
if (test_poDS != NULL && m_ReportErrors)
{
std::cout << "Had to open TEST data source read-only."<<std::endl;
......@@ -1103,13 +1103,13 @@ int TestHelper::RegressionTestOgrFile(const char *testOgrFilename, const char *b
/* -------------------------------------------------------------------- */
if (ref_poDS == NULL)
{
if (m_ReportErrors)
{
std::cout << "FAILURE:\n" "Unable to open REF datasource `" << ref_pszDataSource << "' with the following drivers." << std::endl;
std::vector<std::string> drivers = ogr::version_proxy::GetAvailableDriversAsStringVector();
for (std::vector<std::string>::const_iterator it = drivers.begin();it!=drivers.end();++it)
{
std::cout << " -> " << *it << std::endl;
......@@ -1127,7 +1127,7 @@ int TestHelper::RegressionTestOgrFile(const char *testOgrFilename, const char *b
std::cout << "FAILURE:\n""Unable to open TEST datasource `" << test_pszDataSource << "' with the following drivers." << std::endl;
std::vector<std::string> drivers = ogr::version_proxy::GetAvailableDriversAsStringVector();
for (std::vector<std::string>::const_iterator it = drivers.begin();it!=drivers.end();++it)
{
std::cout << " -> " << *it << std::endl;
......@@ -1165,7 +1165,7 @@ int TestHelper::RegressionTestOgrFile(const char *testOgrFilename, const char *b
}
++fileId;
}
/* -------------------------------------------------------------------- */
/* Process each data source layer. */
/* -------------------------------------------------------------------- */
......@@ -1269,7 +1269,7 @@ void TestHelper::DumpOGRFeature(FILE* fpOut, OGRFeature* feature, char** papszOp
return;
}
fprintf(fpOut, "OGRFeature:%lld\n", feature->GetFID());
fprintf(fpOut, "OGRFeature:%ld\n", feature->GetFID());
const char* pszDisplayFields =
CSLFetchNameValue(papszOptions, "DISPLAY_FIELDS");
......
......@@ -317,7 +317,11 @@ OGRLayerStreamStitchingFilter<TInputImage>
ogr::Field field = upper.feat[0];
try
{
#ifdef OTB_USE_GDAL_20
fusionFeature[0].SetValue(field.GetValue<GIntBig>());
#else
fusionFeature[0].SetValue(field.GetValue<int>());
#endif
m_OGRLayer.CreateFeature(fusionFeature);
m_OGRLayer.DeleteFeature(lower.feat.GetFID());
m_OGRLayer.DeleteFeature(upper.feat.GetFID());
......
......@@ -3,7 +3,4 @@ project(OTBGDAL)
set(OTBGDAL_SYSTEM_INCLUDE_DIRS ${GDAL_INCLUDE_DIRS})
set(OTBGDAL_LIBRARIES "${GDAL_LIBRARIES}")
set(GDAL_CONFIG_CHECKING ON CACHE BOOL "Tests to check gdal config." FORCE)
mark_as_advanced(GDAL_CONFIG_CHECKING)
otb_module_impl()
......@@ -8,6 +8,10 @@ if(NOT GDAL_FOUND)
message(FATAL_ERROR "Cannot find GDAL. Set GDAL_INCLUDE_DIR and GDAL_LIBRARY")
endif()
#Allow to deactivate GDAL checking (done by default)
set(GDAL_CONFIG_CHECKING ON CACHE BOOL "Tests to check gdal config." FORCE)
mark_as_advanced(GDAL_CONFIG_CHECKING)
if(GDAL_CONFIG_CHECKING)
set(MIN_MAJOR_VERSION 1)
set(MIN_MINOR_VERSION 10)
......@@ -89,7 +93,7 @@ if(GDAL_CONFIG_CHECKING)
file(READ "${TEMP}/gdalVersion.txt" DETECTED_VERSION)
string(SUBSTRING ${DETECTED_VERSION} 0 2 VER2)
if(${VER2} EQUAL "2.")
message("-- Gdal >= 2.0.0 detected")
message(STATUS "Gdal >= 2.0.0 detected")
set(OTB_USE_GDAL_20 true CACHE INTERNAL "True if GDAL >= 2.0.0 has been detected" FORCE )
else(${VER2} EQUAL "2.")
set(OTB_USE_GDAL_20 false CACHE INTERNAL "True if GDAL >= 2.0.0 has been detected" FORCE )
......
......@@ -247,6 +247,20 @@ public:
*/
void SetDefaultParameterFloat(std::string parameter, float value);
/** Set a default pixel type for an output image parameter
*
* \param[in] parameter Name of the output image parameter
* \param[in] type Default pixel type
*/
void SetDefaultOutputPixelType(std::string parameter, ImagePixelType type);
/** Set a default complex pixel type for an output complex image parameter
*
* \param[in] parameter Name of the output complex image parameter
* \param[in] type Default complex pixel type
*/
void SetDefaultOutputComplexPixelType(std::string parameter, ComplexImagePixelType type);
/* Set a minimum int value, must used in the
* DoInit when setting a value by default
* for the parameter
......
......@@ -61,14 +61,27 @@ public:
/** Return any value */
ImageBaseType* GetValue( void );
/** Set/Get PixelType to be used when saving */
/** Set/Get m_ComplexPixelType to be used when saving */
itkSetMacro(ComplexPixelType, ComplexImagePixelType);
itkGetMacro(ComplexPixelType, ComplexImagePixelType);
/** Set/Get m_DefaultComplexPixelType*/
itkSetMacro(DefaultComplexPixelType, ComplexImagePixelType);
itkGetMacro(DefaultComplexPixelType, ComplexImagePixelType);
/** Set/Get available RAM value */
itkSetMacro(RAMValue, unsigned int);
itkGetMacro(RAMValue, unsigned int);
/** Implement the reset method (replace pixel type by default type) */
virtual void Reset()
{
m_ComplexPixelType = m_DefaultComplexPixelType;
}
/** Static method to convert pixel type into string */
static std::string ConvertPixelTypeToString(ComplexImagePixelType type);
/** Return true if a filename is set */
bool HasValue() const;
......@@ -106,7 +119,7 @@ protected:
ImageBaseType::Pointer m_Image;
std::string m_FileName;
ComplexImagePixelType m_ComplexPixelType;
ComplexImagePixelType m_DefaultComplexPixelType;
typedef otb::ImageFileWriter<ComplexFloatImageType> ComplexFloatWriterType;
typedef otb::ImageFileWriter<ComplexDoubleImageType> ComplexDoubleWriterType;
......
......@@ -66,10 +66,23 @@ public:
itkSetMacro(PixelType, ImagePixelType);
itkGetMacro(PixelType, ImagePixelType);
/** Set/Get DefaultPixelType */
itkSetMacro(DefaultPixelType, ImagePixelType);
itkGetMacro(DefaultPixelType, ImagePixelType);
/** Set/Get available RAM value */
itkSetMacro(RAMValue, unsigned int);
itkGetMacro(RAMValue, unsigned int);
/** Implement the reset method (replace pixel type by default type) */
virtual void Reset()
{
m_PixelType = m_DefaultPixelType;
}
/** Static method to convert pixel type into string */
static std::string ConvertPixelTypeToString(ImagePixelType type);
/** Return true if a filename is set */
bool HasValue() const;
......@@ -113,6 +126,7 @@ protected:
ImageBaseType::Pointer m_Image;
std::string m_FileName;
ImagePixelType m_PixelType;
ImagePixelType m_DefaultPixelType;
typedef otb::ImageFileWriter<UInt8ImageType> UInt8WriterType;
typedef otb::ImageFileWriter<Int16ImageType> Int16WriterType;
......
......@@ -657,6 +657,29 @@ void Application::SetDefaultParameterFloat(std::string parameter, float value)
}
}
void Application::SetDefaultOutputPixelType(std::string parameter, ImagePixelType type)
{
Parameter* param = GetParameterByKey(parameter);
OutputImageParameter* paramDown = dynamic_cast<OutputImageParameter*>(param);
if (paramDown)
{
paramDown->SetDefaultPixelType(type);
paramDown->SetPixelType(type);
}
}
void
Application::SetDefaultOutputComplexPixelType(std::string parameter, ComplexImagePixelType type)
{
Parameter* param = GetParameterByKey(parameter);
ComplexOutputImageParameter* paramDown = dynamic_cast<ComplexOutputImageParameter*>(param);
if (paramDown)
{
paramDown->SetDefaultComplexPixelType(type);
paramDown->SetComplexPixelType(type);
}
}
void Application::SetMinimumParameterIntValue(std::string parameter, int value)
{
Parameter* param = GetParameterByKey(parameter);
......
......@@ -26,7 +26,9 @@ namespace Wrapper
{
ComplexOutputImageParameter::ComplexOutputImageParameter()
: m_ComplexPixelType(ComplexImagePixelType_float), m_RAMValue(0)
: m_ComplexPixelType(ComplexImagePixelType_float),
m_DefaultComplexPixelType(ComplexImagePixelType_float),
m_RAMValue(0)
{
this->SetName("Complex Output Image");
this->SetKey("cout");
......@@ -36,6 +38,26 @@ ComplexOutputImageParameter::~ComplexOutputImageParameter()
{
}
std::string
ComplexOutputImageParameter::ConvertPixelTypeToString(ComplexImagePixelType type)
{
std::string ret;
switch(type)
{
case ComplexImagePixelType_float:
{
ret = "cfloat";
break;
}
case ComplexImagePixelType_double:
{
ret = "cdouble";
break;
}
}
return ret;
}
void ComplexOutputImageParameter::InitializeWriters()
{
m_ComplexFloatWriter = ComplexFloatWriterType::New();
......
......@@ -25,7 +25,9 @@ namespace Wrapper
{
OutputImageParameter::OutputImageParameter()
: m_PixelType(ImagePixelType_float), m_RAMValue(0)
: m_PixelType(ImagePixelType_float),
m_DefaultPixelType(ImagePixelType_float),
m_RAMValue(0)
{
this->SetName("Output Image");
this->SetKey("out");
......@@ -36,6 +38,50 @@ OutputImageParameter::~OutputImageParameter()
{
}
std::string OutputImageParameter::ConvertPixelTypeToString(ImagePixelType type)
{
std::string ret;
switch(type)
{
case ImagePixelType_uint8:
{
ret = "uint8";
break;
}
case ImagePixelType_int16:
{
ret = "int16";
break;
}
case ImagePixelType_uint16:
{
ret = "uint16";
break;
}
case ImagePixelType_int32:
{
ret = "int32";
break;
}
case ImagePixelType_uint32:
{
ret = "uint32";
break;
}
case ImagePixelType_float:
{
ret = "float";