Commit 2161bb7c authored by Antoine Regimbeau's avatar Antoine Regimbeau

Merge branch 'develop' into connectedcomponents

parents f7598b63 b19f49ad
......@@ -455,7 +455,9 @@ add_subdirectory(Utilities/Doxygen)
add_subdirectory(Utilities/Completion)
if (BUILD_DOCUMENTATION)
option(BUILD_COOKBOOK "Build the CookBook documentation." OFF)
if (BUILD_COOKBOOK)
add_subdirectory(Documentation/Cookbook)
endif()
......
......@@ -226,34 +226,6 @@ like this small example:
For more information about this Python interface, check the recipe section.
QGIS interface
--------------
The processing toolbox
^^^^^^^^^^^^^^^^^^^^^^
OTB applications are available from QGIS. Use them from the processing
toolbox, which is accessible under Processing :math:`\rightarrow`
ToolBox. Switch to “advanced interface” in the bottom of the application
widget and OTB applications will be there.
.. figure:: Art/QtImages/qgis-otb.png
Using a custom OTB
^^^^^^^^^^^^^^^^^^
If QGIS cannot find OTB, the “applications folder” and “binaries folder”
can be set from the settings found under Processing :math:`\rightarrow`
Settings :math:`\rightarrow` “service provider”.
.. figure:: Art/QtImages/qgis-otb-settings.png
On some versions of QGIS, if an existing OTB installation is found, the
textfield settings will not be shown. To use a custom OTB instead of the
existing one, you will need to replace the otbcli, otbgui and library
files in QGIS installation directly.
Load and save parameters to XML
-------------------------------
......
QGIS interface
==============
The QGIS-OTB plugin (requires QGIS > 3.0)
-----------------------------------------
With QGIS 3.0.2 or later, you will need to manually install the plugin.
Clone qgis-otb-plugin repository and set ``QGIS_PLUGINPATH``:
For Linux/Unix/MacOSX
^^^^^^^^^^^^^^^^^^^^^
::
mkdir $HOME/projects; cd $HOME/projects
git clone https://gitlab.orfeo-toolbox.org/orfeotoolbox/qgis-otb-plugin
export QGIS_PLUGINPATH=$HOME/projects/qgis-otb-plugin
For Windows
^^^^^^^^^^^
Clone qgis-otb-plugin repository to ``C:\qgis-plugins\qgis-otb-plugin``
::
git clone https://gitlab.orfeo-toolbox.org/orfeotoolbox/qgis-otb-plugin
Then set the ``QGIS_PLUGINPATH`` variable:
* System properties (``Windows Key + R -> sysdm.cpl`` )
* Select Advanced Tab -> Environment variables.
* Under "user variables for "
* Add or Edit variable ``QGIS_PLUGINPATH`` and set value to ``C:\qgis-plugins\qgis-otb-plugin``
Download and Install OTB
^^^^^^^^^^^^^^^^^^^^^^^^
OTB is not distributed with qgis-otb-plugin. It is a seperate project and has its own git repository.
Download latest OTB version: https://www.orfeo-toolbox.org/download/.
Configure plugin in QGIS
^^^^^^^^^^^^^^^^^^^^^^^^
Restart QGIS, then install the OTB plugin:
`Plugins -> Manage and Install Plugins`.
Click on `Installed` tab on left and make sure box next to `OrfeoToolBox (OTB)` is checked.
Open processing settings
^^^^^^^^^^^^^^^^^^^^^^^^
`Settings -> Options -> Processing (left panel)`
You can see OTB under "Providers":
* Expand OTB tab
* Tick Activate option
* Set OTB folder. This is location of your OTB installation.
* Set OTB application folder. This is location of your OTB applications. ``<OTB_FOLDER>/lib/otb/applications``
* Click "ok" to save settings and close dialog. If settings are correct, you will have OTB algorithms loaded in Processing toolbox
Using the processing toolbox (for QGIS < 3.0)
---------------------------------------------
In older QGIS version (3.0 or before), OTB applications are available from QGIS.
Use them from the processing toolbox, which is accessible under `Processing
-> ToolBox`. Switch to “advanced interface” in the bottom of the
application widget and OTB applications will be there.
.. figure:: Art/QtImages/qgis-otb.png
Using a custom OTB
^^^^^^^^^^^^^^^^^^
If QGIS cannot find OTB, the “applications folder” and “binaries folder”
can be set from the settings found under Processing :math:`\rightarrow`
Settings :math:`\rightarrow` “service provider”.
.. figure:: Art/QtImages/qgis-otb-settings.png
On some versions of QGIS, if an existing OTB installation is found, the
textfield settings will not be shown. To use a custom OTB instead of the
existing one, you will need to replace the otbcli, otbgui and library
files in QGIS installation directly.
......@@ -7,6 +7,7 @@ Table of Contents
index
Installation
OTB-Applications
QGIS-interface
Monteverdi
AdvancedUse
Recipes
......
......@@ -59,14 +59,8 @@ set(OTB_VERSION_STRING_FULL "${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}.${OTB_VER
# Configure the default OTB_DATA_ROOT for the location of OTB Data.
FIND_PATH(OTB_DATA_ROOT README-OTB-Data PATHS $ENV{OTB_DATA_ROOT} ${OTB_SOURCE_DIR}/../OTB-Data)
FIND_PATH(OTB_DATA_LARGEINPUT_ROOT OTBData.readme PATHS $ENV{OTB_DATA_LARGEINPUT_ROOT})
IF( NOT OTB_DATA_LARGEINPUT_ROOT )
MESSAGE(FATAL_ERROR "Large input directory is not set and is mandatory to build the Software Guide.")
ENDIF( NOT OTB_DATA_LARGEINPUT_ROOT )
# OTB_DATA_PATHS is searched recursively.. you need not enter sub-directories
SET(OTB_DATA_PATHS "${OTB_DATA_ROOT}/Examples::${OTB_DATA_ROOT}/Input::${OTB_DATA_LARGEINPUT_ROOT}" CACHE STRING "Where the OTB data is. Enter a double colon separated list.")
SET(OTB_DATA_PATHS "${OTB_DATA_ROOT}/Examples::${OTB_DATA_ROOT}/Input" CACHE STRING "Where the OTB data is. Enter a double colon separated list.")
#
# Rebuild the Software Guide figures or not ?
......
......@@ -132,13 +132,13 @@ otb_add_test(NAME fiTeMathematicalMorphologyGrayscaleFiltersTest COMMAND ${OTB_T
otb_add_test(NAME fiTeLaplacianRecursiveGaussianImageFilter1Test COMMAND ${OTB_TEST_DRIVER}
--compare-n-images ${NOTOL} 2
${BASELINE}/LaplacianRecursiveGaussianImageFilteroutput5.hdr
${TEMP}/LaplacianRecursiveGaussianImageFilteroutput5.hdr
${BASELINE}/LaplacianRecursiveGaussianImageFilteroutput5.tif
${TEMP}/LaplacianRecursiveGaussianImageFilteroutput5.tif
${BASELINE}/LaplacianRecursiveGaussianImageFilterOutput5.png
${TEMP}/LaplacianRecursiveGaussianImageFilterOutput5.png
Execute $<TARGET_FILE:LaplacianRecursiveGaussianImageFilter1>
${INPUTDATA}/ROISpot5.png
${TEMP}/LaplacianRecursiveGaussianImageFilteroutput5.hdr
${TEMP}/LaplacianRecursiveGaussianImageFilteroutput5.tif
5
${TEMP}/LaplacianRecursiveGaussianImageFilterOutput5.png
)
......@@ -148,13 +148,13 @@ otb_add_test(NAME fiTeLaplacianRecursiveGaussianImageFilter1Test COMMAND ${OTB_T
otb_add_test(NAME fiTeLaplacianRecursiveGaussianImageFilter2Test COMMAND ${OTB_TEST_DRIVER}
--compare-n-images ${NOTOL} 2
${BASELINE}/LaplacianRecursiveGaussianImageFilter2output5.hdr
${TEMP}/LaplacianRecursiveGaussianImageFilter2output5.hdr
${BASELINE}/LaplacianRecursiveGaussianImageFilter2output5.tif
${TEMP}/LaplacianRecursiveGaussianImageFilter2output5.tif
${BASELINE}/LaplacianRecursiveGaussianImageFilter2Output5.png
${TEMP}/LaplacianRecursiveGaussianImageFilter2Output5.png
Execute $<TARGET_FILE:LaplacianRecursiveGaussianImageFilter2>
${INPUTDATA}/ROISpot5.png
${TEMP}/LaplacianRecursiveGaussianImageFilter2output5.hdr
${TEMP}/LaplacianRecursiveGaussianImageFilter2output5.tif
5
${TEMP}/LaplacianRecursiveGaussianImageFilter2Output5.png
)
......@@ -210,13 +210,13 @@ otb_add_test(NAME fiTeBinaryThresholdImageFilterTest COMMAND ${OTB_TEST_DRIVER}
otb_add_test(NAME fiTeDerivativeImageFilterTest COMMAND ${OTB_TEST_DRIVER}
--compare-n-images ${NOTOL} 2
${BASELINE}/DerivativeImageFilterFloatOutput.hdr
${TEMP}/DerivativeImageFilterFloatOutput.hdr
${BASELINE}/DerivativeImageFilterFloatOutput.tif
${TEMP}/DerivativeImageFilterFloatOutput.tif
${BASELINE}/DerivativeImageFilterOutput.png
${TEMP}/DerivativeImageFilterOutput.png
Execute $<TARGET_FILE:DerivativeImageFilter>
${INPUTDATA}/ROISpot5.png
${TEMP}/DerivativeImageFilterFloatOutput.hdr
${TEMP}/DerivativeImageFilterFloatOutput.tif
${TEMP}/DerivativeImageFilterOutput.png
1 0
)
......@@ -30,7 +30,7 @@ otb_add_test(NAME siTvHyperspectralExampleTest COMMAND ${OTB_TEST_DRIVER}
${BASELINE}/siTvHyperspectralUnmixingExampleTestBand3.png
${TEMP}/siTvHyperspectralUnmixingExampleTestBand3.png
Execute $<TARGET_FILE:HyperspectralUnmixingExample>
LARGEINPUT{AVIRIS/Indian_pines_corrected.tif}
${INPUTDATA}/AVIRIS/Indian_pines_corrected.tif
${TEMP}/siTvHyperspectralUnmixingExampleTest.tif
${TEMP}/siTvHyperspectralUnmixingExampleTestBand1.png
${TEMP}/siTvHyperspectralUnmixingExampleTestBand2.png
......
......@@ -70,12 +70,13 @@ target_link_libraries(RGBImageReadWrite ${OTB_LIBRARIES})
add_executable(StreamingImageReadWrite StreamingImageReadWrite.cxx)
target_link_libraries(StreamingImageReadWrite ${OTB_LIBRARIES})
add_executable(TileMapImageIOExample TileMapImageIOExample.cxx)
target_link_libraries(TileMapImageIOExample ${OTB_LIBRARIES})
add_executable(VectorDataIOExample VectorDataIOExample.cxx)
target_link_libraries(VectorDataIOExample ${OTB_LIBRARIES})
if(OTB_USE_DEPRECATED)
add_executable(TileMapImageIOExample TileMapImageIOExample.cxx)
target_link_libraries(TileMapImageIOExample ${OTB_LIBRARIES})
endif()
if(BUILD_TESTING)
add_subdirectory(test)
......
......@@ -101,7 +101,8 @@ otb_add_test(NAME ioTeImageToKmzAndMapFileProductExample COMMAND ${OTB_TEST_DRIV
set_property(TEST ioTeImageToKmzAndMapFileProductExample PROPERTY RESOURCE_LOCK web_access)
endif()
otb_add_test(NAME ioTeTileMapImageIOExampleTest COMMAND ${OTB_TEST_DRIVER}
if(OTB_USE_DEPRECATED)
otb_add_test(NAME ioTeTileMapImageIOExampleTest COMMAND ${OTB_TEST_DRIVER}
--compare-image 10.0
${BASELINE}/openStreetMap.png
${TEMP}/openStreetMap.png
......@@ -112,4 +113,5 @@ otb_add_test(NAME ioTeTileMapImageIOExampleTest COMMAND ${OTB_TEST_DRIVER}
1.4835345
43.55968261
12
)
)
endif()
......@@ -118,11 +118,13 @@ otb_add_test(NAME prTePlaceNameToLonLatExampleTest COMMAND ${OTB_TEST_DRIVER}
Execute $<TARGET_FILE:PlaceNameToLonLatExample>
Toulouse
)
otb_add_test(NAME prTeCoordinateToNameExampleTest COMMAND ${OTB_TEST_DRIVER}
--compare-ascii ${NOTOL}
${BASELINE}/CoordinateToNameExample.txt
${TEMP}/CoordinateToNameExample.txt
Execute $<TARGET_FILE:CoordinateToNameExample>
103.78 1.29
${TEMP}/CoordinateToNameExample.txt
)
# The following test is disabled (GitLab #1669 !244)
# otb_add_test(NAME prTeCoordinateToNameExampleTest COMMAND ${OTB_TEST_DRIVER}
# --compare-ascii ${NOTOL}
# ${BASELINE}/CoordinateToNameExample.txt
# ${TEMP}/CoordinateToNameExample.txt
# Execute $<TARGET_FILE:CoordinateToNameExample>
# 103.78 1.29
# ${TEMP}/CoordinateToNameExample.txt
# )
......@@ -100,7 +100,7 @@ const ExtensionDriverAssociation k_ExtensionDriverMap[] =
char const* DeduceDriverName(std::string filename)
{
std::transform(filename.begin(), filename.end(), filename.begin(), (int (*)(int))toupper);
if (0 == strncmp(filename.c_str(), "PG:", 3))
if(filename.compare(0, 3, "PG:") == 0)
{
return "PostgreSQL";
}
......
/*
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef otbDEMConvertAdapter_h
#define otbDEMConvertAdapter_h
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "OTBOSSIMAdaptersExport.h"
namespace otb
{
class OTBOSSIMAdapters_EXPORT DEMConvertAdapter: public itk::Object
{
public:
/** Standard class typedefs. */
typedef DEMConvertAdapter Self;
typedef itk::Object Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(EllipsoidAdapter, itk::Object);
int Convert(std::string tempFilename, std::string output);
protected:
DEMConvertAdapter();
~DEMConvertAdapter() override;
private:
DEMConvertAdapter(const Self &) = delete;
void operator =(const Self&) = delete;
};
} // namespace otb
#endif
/*
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef otbGeometricSarSensorModelAdapter_h
#define otbGeometricSarSensorModelAdapter_h
#include <vector>
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "OTBOSSIMAdaptersExport.h"
namespace ossimplugins
{
class ossimGeometricSarSensorModel;
class JSDDateTime;
}
namespace otb
{
class ImageKeywordlist;
/**
* \class GeometricSarSensorModelAdapter
* \brief Wrapper class to access the platform Geometric Sar
* Sensor Modelposition from ossim.
*
* This class is intended to be used in an InSAR setting to get
* information relative to the baseline. If necessary, it could be
* extended to non SAR models, but the optical ossim classes would
* need to be modified.
*
* \ingroup OTBOSSIMAdapters
**/
class OTBOSSIMAdapters_EXPORT GeometricSarSensorModelAdapter: public itk::Object
{
public:
/** Standard class typedefs. */
typedef GeometricSarSensorModelAdapter Self;
typedef itk::Object Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(GeometricSarSensorModelAdapter, itk::Object);
void CreateSensorModel(const ImageKeywordlist& image_kwl);
/** Get the platform position and speed for a given line. */
void GetPlatformPositionAtLine(
double line, std::vector<double>& position, std::vector<double>& speed);
/** Get the platform time for a given line. */
ossimplugins::JSDDateTime getTime(double line);
protected:
GeometricSarSensorModelAdapter();
~GeometricSarSensorModelAdapter() override;
private:
GeometricSarSensorModelAdapter(const Self &) = delete;
void operator =(const Self&) = delete;
ossimplugins::ossimGeometricSarSensorModel* m_SensorModel;
};
} // namespace otb
#endif
/*
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef otbPlatformPositionAdapter_h
#define otbPlatformPositionAdapter_h
#include <vector>
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "OTBOSSIMAdaptersExport.h"
namespace ossimplugins
{
class ossimGeometricSarSensorModel;
class JSDDateTime;
}
namespace otb
{
class ImageKeywordlist;
/**
* \class PlatformPositionAdapter
* \brief Wrapper class to access the platform position from ossim
*
* This class is intended to be used in an InSAR setting to get
* information relative to the baseline. If necessary, it could be
* extended to non SAR models, but the optical ossim classes would
* need to be modified.
*
* \ingroup OTBOSSIMAdapters
**/
class OTBOSSIMAdapters_EXPORT PlatformPositionAdapter: public itk::Object
{
public:
/** Standard class typedefs. */
typedef PlatformPositionAdapter Self;
typedef itk::Object Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(PlatformPositionAdapter, itk::Object);
void CreateSensorModel(const ImageKeywordlist& image_kwl);
/** Get the platform position and speed for a given line. */
void GetPlatformPosition(
double line, std::vector<double>& position, std::vector<double>& speed);
/** Get the platform position at a given date and time. */
void GetPlatformPositionAtTime(
ossimplugins::JSDDateTime time, std::vector<double>& position, std::vector<double>& speed);
protected:
PlatformPositionAdapter();
~PlatformPositionAdapter() override;
private:
PlatformPositionAdapter(const Self &) = delete;
void operator =(const Self&) = delete;
ossimplugins::ossimGeometricSarSensorModel* m_SensorModel;
};
} // namespace otb
#endif
......@@ -21,10 +21,7 @@
set(OTBOSSIMAdapters_SRC
otbDEMHandler.cxx
otbImageKeywordlist.cxx
otbGeometricSarSensorModelAdapter.cxx
otbSensorModelAdapter.cxx
otbPlatformPositionAdapter.cxx
otbDEMConvertAdapter.cxx
otbRPCSolverAdapter.cxx
otbDateTimeAdapter.cxx
otbMapProjectionAdapter.cxx
......
/*
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "otbDEMConvertAdapter.h"
#include "itkMacro.h"
// OSSIM include
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
#pragma GCC diagnostic ignored "-Wshadow"
#include "ossim/base/ossimKeywordNames.h"
#include "ossim/base/ossimStdOutProgress.h"
#include "ossim/base/ossimFilename.h"
#include "ossim/base/ossimKeywordlist.h"
#include "ossim/imaging/ossimJpegWriter.h"
#include "ossim/imaging/ossimImageHandler.h"
#include "ossim/imaging/ossimImageSource.h"
#include "ossim/imaging/ossimImageHandlerRegistry.h"
#include "ossim/imaging/ossimImageWriterFactoryRegistry.h"
#include "ossim/imaging/ossimImageWriterFactory.h"
#include "ossim/imaging/ossimImageFileWriter.h"
#include "ossim/imaging/ossimCacheTileSource.h"
#include "ossim/imaging/ossimBandSelector.h"
#include "ossim/imaging/ossimCibCadrgTileSource.h"
#pragma GCC diagnostic pop
#else
#include "ossim/base/ossimKeywordNames.h"
#include "ossim/base/ossimStdOutProgress.h"
#include "ossim/base/ossimFilename.h"
#include "ossim/base/ossimKeywordlist.h"
#include "ossim/imaging/ossimJpegWriter.h"
#include "ossim/imaging/ossimImageHandler.h"
#include "ossim/imaging/ossimImageSource.h"
#include "ossim/imaging/ossimImageHandlerRegistry.h"
#include "ossim/imaging/ossimImageWriterFactoryRegistry.h"
#include "ossim/imaging/ossimImageWriterFactory.h"
#include "ossim/imaging/ossimImageFileWriter.h"
#include "ossim/imaging/ossimCacheTileSource.h"
#include "ossim/imaging/ossimBandSelector.h"
#include "ossim/imaging/ossimCibCadrgTileSource.h"
#endif
namespace otb
{
DEMConvertAdapter::DEMConvertAdapter()
{}
DEMConvertAdapter::~DEMConvertAdapter()
{}
int DEMConvertAdapter::Convert(std::string tempFilename, std::string output)
{
// Keyword list to initialize image writers with.
ossimKeywordlist kwl;
const char* PREFIX = "imagewriter.";
// Define the output file type
std::string output_type("general_raster_bsq_envi");
kwl.add(PREFIX, ossimKeywordNames::TYPE_KW, output_type.c_str(), true);
// Get an image handler for the input file.
ossimRefPtr<ossimImageHandler> ih = ossimImageHandlerRegistry::instance()->open(ossimString(tempFilename));
// Initialize the
if (ih->getErrorStatus() == ossimErrorCodes::OSSIM_ERROR)
{
itkExceptionMacro("Error reading image: " << tempFilename << "Exiting application...");
return EXIT_FAILURE;
}
ih->initialize();
ossimRefPtr<ossimImageSource> source = ih.get();
ossimRefPtr<ossimBandSelector> bs = nullptr;
// Get the image rectangle for the rrLevel selected.
ossimIrect output_rect;
output_rect = source->getBoundingRect(0);
ossimRefPtr<ossimImageFileWriter> writer =
ossimImageWriterFactoryRegistry::instance()->createWriter(kwl, PREFIX);
writer->connectMyInputTo(0, source.get());
writer->open(ossimFilename(output));
// Add a listener to get percent complete.
ossimStdOutProgress prog(0, true);
writer->addListener(&prog);
if (writer->getErrorStatus() == ossimErrorCodes::OSSIM_OK)
{
if( (ih->getOutputScalarType() != OSSIM_UCHAR) &&
(PTR_CAST(ossimJpegWriter, writer.get()) ) )
{
writer->setScaleToEightBitFlag(true);
}
ossimRefPtr<ossimCacheTileSource> cache = new ossimCacheTileSource;
ossimIpt tileWidthHeight(ih->getImageTileWidth(),
ih->getImageTileHeight());
// only use the cache if its stripped
if(static_cast<ossim_uint32>(tileWidthHeight.x) ==
ih->getBoundingRect().width())
{
cache->connectMyInputTo(0, source.get());
cache->setTileSize(tileWidthHeight);
writer->connectMyInputTo(0, cache.get());
}
else
{
writer->connectMyInputTo(0, source.get());