27 #include "../raster/BandProperty.h" 28 #include "../raster/Grid.h" 29 #include "../raster/RasterFactory.h" 41 const std::string& fileName )
43 std::map<std::string, std::string> rinfo;
44 rinfo[
"SOURCE"] = fileName;
51 std::vector< te::rst::BandProperty* > bandsProps;
56 gridPtr, bandsProps, rinfo );
60 unsigned int line = 0;
66 double minValue = DBL_MAX;
67 double maxValue = -1.0 * DBL_MAX;
70 for( line = 0 ; line < linesNmb ; ++
line ) {
71 for( col = 0 ; col < colsNmb ; ++
col ) {
72 value = (double)segmentsIds( line, col );
74 if( value > maxValue ) maxValue = value;
75 if( value < minValue ) minValue = value;
80 scale = 254.0 / ( maxValue - minValue );
85 for( line = 0 ; line < linesNmb ; ++
line ) {
86 for( col = 0 ; col < colsNmb ; ++
col ) {
87 value = ( ((double)segmentsIds( line, col )) - offset ) * scale;
89 boost::lexical_cast< std::string >( value ) );
91 rasterPtr->
setValue( col, line, value , 0 );
virtual void setValue(unsigned int c, unsigned int r, const double value, std::size_t b=0)
Sets the attribute value in a band of a cell.
A raster band description.
An abstract class for raster data strucutures.
unsigned int getColumnsNumber() const
The number of current matrix columns.
static Raster * make()
It creates and returns an empty raster with default raster driver.
A rectified grid is the spatial support for raster data.
unsigned int getLinesNumber() const
The number of current matrix lines.
void exportSegs2Tif(const SegmentsIdsMatrixT &segmentsIds, bool normto8bits, const std::string &fileName)
Export the segments IDs to a tif file.
#define TERP_TRUE_OR_THROW(value, message)
Checks if value is true and throws an exception if not.