75 static ossimTrace traceDebug(
"ossimChipperUtil:debug");
76 static ossimTrace traceLog(
"ossimChipperUtil:log");
77 static ossimTrace traceOptions(
"ossimChipperUtil:options");
79 static const std::string BRIGHTNESS_KW =
"brightness";
80 static const std::string COLOR_BLUE_KW =
"color_blue";
81 static const std::string COLOR_GREEN_KW =
"color_green";
82 static const std::string COLOR_RED_KW =
"color_red";
83 static const std::string CONTRAST_KW =
"contrast";
84 static const std::string CLIP_WMS_BBOX_LL_KW =
"clip_wms_bbox_ll";
85 static const std::string CLIP_POLY_LAT_LON_KW =
"clip_poly_lat_lon";
86 static const std::string CUT_BBOX_XYWH_KW =
"cut_bbox_xywh";
87 static const std::string CUT_WMS_BBOX_KW =
"cut_wms_bbox";
88 static const std::string CUT_WMS_BBOX_LL_KW =
"cut_wms_bbox_ll";
89 static const std::string CUT_CENTER_LAT_KW =
"cut_center_lat";
90 static const std::string CUT_CENTER_LON_KW =
"cut_center_lon";
91 static const std::string CUT_RADIUS_KW =
"cut_radius";
92 static const std::string CUT_HEIGHT_KW =
"cut_height";
93 static const std::string CUT_MAX_LAT_KW =
"cut_max_lat";
94 static const std::string CUT_MAX_LON_KW =
"cut_max_lon";
95 static const std::string CUT_MIN_LAT_KW =
"cut_min_lat";
96 static const std::string CUT_MIN_LON_KW =
"cut_min_lon";
97 static const std::string CUT_WIDTH_KW =
"cut_width";
98 static const std::string DEM_KW =
"dem";
99 static const std::string GAIN_KW =
"gain";
100 static const std::string FILE_KW =
"file";
101 static const std::string FULLRES_XYS_KW =
"fullres_xys";
102 static const std::string HIST_AOI_KW =
"hist_aoi";
103 static const std::string HIST_CENTER_KW =
"hist_center";
104 static const std::string HIST_LLWH_KW =
"hist_llwh";
105 static const std::string HIST_OP_KW =
"hist_op";
106 static const std::string IMAGE_SPACE_SCALE_X_KW =
"image_space_scale_x";
107 static const std::string IMAGE_SPACE_SCALE_Y_KW =
"image_space_scale_y";
108 static const std::string IMG_KW =
"image";
109 static const std::string LUT_FILE_KW =
"lut_file";
110 static const std::string DEGREES_X_KW =
"degrees_x";
111 static const std::string DEGREES_Y_KW =
"degrees_y";
112 static const std::string METERS_KW =
"meters";
113 static const std::string NORTH_UP_KW =
"north_up";
114 static const std::string OP_KW =
"operation";
115 static const std::string OUTPUT_RADIOMETRY_KW =
"output_radiometry";
116 static const std::string PAD_THUMBNAIL_KW =
"pad_thumbnail";
117 static const std::string READER_PROPERTY_KW =
"reader_property";
118 static const std::string RESAMPLER_FILTER_KW =
"resampler_filter";
119 static const std::string ROTATION_KW =
"rotation";
120 static const std::string RRDS_KW =
"rrds";
121 static const std::string SCALE_2_8_BIT_KW =
"scale_2_8_bit";
122 static const std::string SHARPEN_MODE_KW =
"sharpen_mode";
123 static const std::string SNAP_TIE_TO_ORIGIN_KW =
"snap_tie_to_origin";
124 static const std::string SRC_FILE_KW =
"src_file";
125 static const std::string SRS_KW =
"srs";
126 static const std::string THREE_BAND_OUT_KW =
"three_band_out";
127 static const std::string THUMBNAIL_RESOLUTION_KW =
"thumbnail_resolution";
128 static const std::string TILE_SIZE_KW =
"tile_size";
129 static const std::string TRUE_KW =
"true";
130 static const std::string UP_IS_UP_KW =
"up_is_up";
131 static const std::string WRITER_KW =
"writer";
132 static const std::string WRITER_PROPERTY_KW =
"writer_property";
133 static const std::string COMBINER_TYPE_KW =
"combiner_type";
134 static const std::string NULL_PIXEL_FLIP_KW =
"null_pixel_flip";
136 static const std::string TWOCMV_OLD_INPUT_BAND_KW =
"2cmv_old_input_band";
137 static const std::string TWOCMV_NEW_INPUT_BAND_KW =
"2cmv_new_input_band";
138 static const std::string TWOCMV_RED_OUTPUT_SOURCE_KW =
"2cmv_red_output_source";
139 static const std::string TWOCMV_GREEN_OUTPUT_SOURCE_KW =
"2cmv_green_output_source";
140 static const std::string TWOCMV_BLUE_OUTPUT_SOURCE_KW =
"2cmv_blue_output_source";
144 m_operation(OSSIM_CHIPPER_OP_UNKNOWN),
159 : m_operation(OSSIM_CHIPPER_OP_UNKNOWN)
173 if(combinerType.
empty())
175 combinerType =
"ossimImageMosaic";
195 usageString +=
" [option]... [input-option]... <input-file(s)> <output-file>\nNote at least one input is required either from one of the input options, e.g. --input-dem <my-dem.hgt> or adding to command line in front of the output file in which case the code will try to ascertain what type of input it is.\n\nAvailable traces:\n-T \"ossimChipperUtil:debug\" - General debug trace to standard out.\n-T \"ossimChipperUtil:log\" - Writes a log file to output-file.log.\n-T \"ossimChipperUtil:options\" - Writes the options to output-file-options.kwl.";
203 au->
addCommandLineOption(
"--azimuth",
"<azimuth>\nhillshade option - Light source azimuth angle for bump shade.\nRange: 0 to 360, Default = 180.0");
205 au->
addCommandLineOption(
"-b or --bands <n,n...>",
"Use the specified bands in given order: e.g. \"3,2,1\" will select bands 3, 2 and 1 of the input image.\nNote: it is 1 based" );
207 au->
addCommandLineOption(
"--brightness",
"<brightness>\nApply brightness to input image(s). Valid range: -1.0 to 1.0" );
209 au->
addCommandLineOption(
"--central-meridian",
"<central_meridian_in_decimal_degrees>\nNote if set this will be used for the central meridian of the projection. This can be used to lock the utm zone.");
211 au->
addCommandLineOption(
"--color",
"<r> <g> <b>\nhillshade option - Set the red, green and blue color values to be used with hillshade.\nThis option can be used with or without an image source for color.\nRange 0 to 255, Defualt r=255, g=255, b=255");
213 au->
addCommandLineOption(
"--color-table",
"<color-table.kwl>\nhillshade or color-relief option - Keyword list containing color table for color-relief option.");
215 au->
addCommandLineOption(
"--contrast",
"<constrast>\nApply constrast to input image(s). Valid range: -1.0 to 1.0" );
217 au->
addCommandLineOption(
"--cut-bbox-xywh",
"<x>,<y>,<width>,<height>\nSpecify a comma separated bounding box.");
219 au->
addCommandLineOption(
"--cut-wms-bbox",
"<minx>,<miny>,<maxx>,<maxy>\nSpecify a comma separated list in the format of a WMS BBOX.\nThe units are in the units of the projector defined by the --srs key");
221 au->
addCommandLineOption(
"--cut-wms-bbox-ll",
"<minx>,<miny>,<maxx>,<maxy>\nSpecify a comma separated list in the format of a WMS BBOX.\nThe units are always decimal degrees");
227 au->
addCommandLineOption(
"--clip-wms-bbox-ll",
"<minx>,<miny>,<maxx>,<maxy>\nSpecify a comma separated list in the format of a WMS BBOX.\nThe units are always decimal degrees");
229 au->
addCommandLineOption(
"--clip-poly-lat-lon",
"Polygon in the form of a string: (lat,lon),(lat,lon),...(lat,lon)");
231 au->
addCommandLineOption(
"--cut-bbox-ll",
"<min_lat> <min_lon> <max_lat> <max_lon>\nSpecify a bounding box with the minimum latitude/longitude and max latitude/longitude in decimal degrees.\nNote coordinates are edge to edge.");
233 au->
addCommandLineOption(
"--cut-bbox-llwh",
"<min_lat> <min_lon> <max_lat> <max_lon> <width> <height>\nSpecify a bounding box with the minimum latitude/longitude, max latitude/longitude in decimal degrees and width/height in pixels.\nNote coordinates are edge to edge.");
235 au->
addCommandLineOption(
"--cut-center-llwh",
"<latitude> <longitude> <width> <height>\nSpecify the center cut in latitude longitude space with width and height in pixels.");
237 au->
addCommandLineOption(
"--cut-center-llr",
"<latitude> <longitude> <radius_in_meters>\nSpecify the center cut in latitude longitude space with radius in meters.");
239 au->
addCommandLineOption(
"--degrees",
"<dpp_xy> | <dpp_x> <dpp_y>\nSpecifies an override for degrees per pixel. Takes either a single value applied equally to x and y directions, or two values applied correspondingly to x then y. This option takes precedence over the \"--meters\" option.");
241 au->
addCommandLineOption(
"--enable-null-pixel-flip",
"Will add to the start of the chain and will flip interior pixels that are null to valid.");
242 au->
addCommandLineOption(
"--elevation",
"<elevation>\nhillshade option - Light source elevation angle for bumb shade.\nRange: 0 to 90, Default = 45.0");
244 au->
addCommandLineOption(
"-e or --entry",
"<entry> For multi image handlers which entry do you wish to extract. For list of entries use: \"ossim-info -i <your_image>\" ");
246 au->
addCommandLineOption(
"--exaggeration",
"<factor>\nMultiplier for elevation values when computing surface normals. Has the effect of lengthening shadows for oblique lighting.\nRange: .0001 to 50000, Default = 1.0");
248 au->
addCommandLineOption(
"--fullres-xys",
"<full res center x>,<full res center y>,<scale>[,<scale>]\nSpecify a full resolution x,y point (Used as pivot and center cut) and scale, comma seperated with no spaces. If two scales are specified then first is x and second is y else x and y are set to equal scales");
252 au->
addCommandLineOption(
"--hemisphere",
"<hemisphere>\nSpecify a projection hemisphere if supported. E.g. UTM projection. This will lock the hemisphere even if input scene center is the other hemisphere. Valid values for UTM are \"N\" and \"S\"");
254 au->
addCommandLineOption(
"--histogram-aoi",
"<x>,<y>,<width>,<height>\nSets single image region of interest(roi) to compute histogram from. Coordinates are zero based image space. Single image operation only. Comma separated, no spaces.");
256 au->
addCommandLineOption(
"--histogram-center-tile",
"Will compute histogram from center tile of image.");
258 au->
addCommandLineOption(
"--histogram-llwh",
"<latitude>,<longitude>,<width>,<height>\nSpecify the region of interest(roi) to compute histogram from. Latitude and longitude will be roi center space with width and height in pixels. Comma separated, no spaces.");
260 au->
addCommandLineOption(
"--histogram-op",
"<operation>\nHistogram operation to perform. Valid operations are \"auto-minmax\", \"auto-percentile\", \"std-stretch-1\", \"std-stretch-2\" and \"std-stretch-3\".");
262 au->
addCommandLineOption(
"--image-space-scale",
"<x> <y>\nSpecifies an image space scale for x and y direction. \"chip\" operation only.");
268 au->
addCommandLineOption(
"--input-src",
"<file.src> Input source file list keyword list with list of dems or images or both to process.");
270 au->
addCommandLineOption(
"--meters",
"<meters>\nSpecifies an override for the meters per pixel");
272 au->
addCommandLineOption(
"-n or --north-up",
"Rotates image North up. \"chip\" operation only.");
274 au->
addCommandLineOption(
"--op",
"<operation>\nOperation to perform. Valid operations are \"chip\", \"color-relief\", \"hillshade\", \"psm\"(pan sharpened multispectral), \"2cmv\"(two color multi view) and \"ortho\".\nchip = input projection = output projection(image space), single image operation only." );
276 au->
addCommandLineOption(
"--options",
"<options.kwl> This can be all or part of the application options. To get a template you can turn on trace to the ossimChipperUtil class by adding \"-T ossimChipperUtil\" to your command.");
278 au->
addCommandLineOption(
"--origin-latitude",
"<latidude_in_decimal_degrees>\nNote if set this will be used for the origin latitude of the projection. Setting this to something other than 0.0 with a geographic projection creates a scaled geographic projection.");
280 au->
addCommandLineOption(
"--output-radiometry",
"<R>\nSpecifies the desired product's pixel radiometry type. Possible values for <R> are: U8, U11, U16, S16, F32. Note this overrides the deprecated option \"scale-to-8-bit\".");
282 au->
addCommandLineOption(
"--pad-thumbnail",
"<boolean>\nIf true, output thumbnail dimensions will be padded in width or height to make square; else, it will have the aspect ratio of input, Default=false");
284 au->
addCommandLineOption(
"--projection",
"<output_projection> Valid projections: geo, geo-scaled, input or utm\ngeo = Equidistant Cylindrical, origin latitude = 0.0\ngeo-scaled = Equidistant Cylindrical, origin latitude = image center\ninput Use first images projection. Must be a map projecion.\nutm = Universal Tranverse Mercator\nIf input and multiple sources the projection of the first image will be used.\nIf utm the zone will be set from the scene center of first image.\nNOTE: --srs takes precedence over this option.");
286 au->
addCommandLineOption(
"--resample-filter",
"<type>\nSpecify what resampler filter to use, e.g. nearest neighbor, bilinear, cubic, sinc.\nSee ossim-info --resampler-filters");
288 au->
addCommandLineOption(
"-r or --rotate",
"<degrees>\nRotate image by degrees. \"chip\" operation only.");
290 au->
addCommandLineOption(
"--reader-prop",
"<string>Adds a property to send to the reader. format is name=value");
292 au->
addCommandLineOption(
"--rrds",
"<rrds> Reduced resolution data set where 0 is full resolution. \"chip\" operation only.");
294 au->
addCommandLineOption(
"--scale-to-8-bit",
"Scales the output to unsigned eight bits per band. This option has been deprecated by the newer \"--output-radiometry\" option.");
296 au->
addCommandLineOption(
"--sharpen-mode",
"<mode> Applies sharpness to image chain(s). Valid modes: \"light\", \"heavy\"");
299 "Snaps tie point to projection origin so that (tie-origin)/gsd come out on an even integer boundary.");
301 au->
addCommandLineOption(
"--srs",
"<src_code>\nSpecify a spatial reference system(srs) code for the output projection. Example: --srs EPSG:4326");
303 au->
addCommandLineOption(
"-t or --thumbnail",
"<max_dimension>\nSpecify a thumbnail resolution.\nScale will be adjusted so the maximum dimension = argument given.");
305 au->
addCommandLineOption(
"--three-band-out",
"Force three band output even if input is not. Attempts to map bands to RGB if possible.");
307 au->
addCommandLineOption(
"--tile-size",
"<size_in_pixels>\nSets the output tile size if supported by writer. Notes: This sets both dimensions. Must be a multiple of 16, e.g. 1024.");
309 au->
addCommandLineOption(
"-u or --up-is-up",
"Rotates image to up is up. \"chip\" operation only.");
311 au->
addCommandLineOption(
"-w or --writer",
"<writer>\nSpecifies the output writer. Default uses output file extension to determine writer. For valid output writer types use: \"ossim-info --writers\"\n");
313 au->
addCommandLineOption(
"--writer-prop",
"<writer-property>\nPasses a name=value pair to the writer for setting it's property. Any number of these can appear on the line.");
315 au->
addCommandLineOption(
"--zone",
"<zone>\nSpecify a projection zone if supported. E.g. UTM projection. This will lock the zone even if input scene center is in another zone. Valid values for UTM are \"1\" to \"60\"");
317 au->
addCommandLineOption(
"--2cmv-old-input-band",
"<band>\nBand to use for two color multi view old input.\n");
318 au->
addCommandLineOption(
"--2cmv-new-input-band",
"<band>\nBand to use for two color multi view new input.\n");
320 au->
addCommandLineOption(
"--2cmv-red-output-source",
"<source>\nTwo color multi view source input for red output. Either, old, new, or mp(min pix). Default=old.\n");
322 au->
addCommandLineOption(
"--2cmv-green-output-source",
"<source>\nTwo color multi view source input for green output. Either, old, new, or mp(min pix). Default=new.\n");
324 au->
addCommandLineOption(
"--2cmv-blue-output-source",
"<source>\nTwo color multi view source input for blue output. Either, old, new, or mp(min pix). Default=new.\n");
325 au->
addCommandLineOption(
"--combiner-type",
"<type>\nossimBlendMosaic, ossimFeatherMosaic, ossimImageMosaic. Default: ossimImageMosaic. Example --combiner-type ossimImageMosaic\n");
332 std::vector< ossimRefPtr<ossimSingleImageChain> >::iterator i =
m_imgLayer.begin();
359 static const char MODULE[] =
"ossimChipperUtil::initialize(ossimArgumentParser&)";
367 if( ap.
read(
"-h") || ap.
read(
"--help") || (ap.
argc() == 1) )
377 std::string tempString1;
379 std::string tempString2;
381 std::string tempString3;
383 std::string tempString4;
385 std::string tempString5;
387 std::string tempString6;
401 if( ap.
read(
"--azimuth", stringParam1) )
406 if (ap.
read(
"-b", stringParam1) || ap.
read(
"--bands", stringParam1))
411 if( ap.
read(
"--brightness", stringParam1) )
416 if( ap.
read(
"--central-meridian", stringParam1) )
421 if( ap.
read(
"--color", stringParam1, stringParam2, stringParam3) )
428 if( ap.
read(
"--color-table", stringParam1) )
433 if( ap.
read(
"--contrast", stringParam1) )
438 if( ap.
read(
"--cut-width", stringParam1) )
442 if( ap.
read(
"--cut-height", stringParam1) )
446 if( ap.
read(
"--cut-bbox-xywh", stringParam1) )
450 if( ap.
read(
"--cut-wms-bbox", stringParam1) )
454 if( ap.
read(
"--cut-wms-bbox-ll", stringParam1) )
459 if( ap.
read(
"--clip-wms-bbox-ll", stringParam1) )
464 if( ap.
read(
"--clip-poly-lat-lon", stringParam1) )
474 if( ap.
read(
"--cut-bbox-ll", stringParam1, stringParam2, stringParam3, stringParam4) )
482 if( ap.
read(
"--cut-bbox-llwh", stringParam1, stringParam2, stringParam3,
483 stringParam4, stringParam5, stringParam6) )
493 if( ap.
read(
"--cut-center-llwh", stringParam1, stringParam2, stringParam3, stringParam4) )
501 if( ap.
read(
"--cut-center-llr", stringParam1, stringParam2, stringParam3) )
511 ap.
read(
"--degrees", doubleParam1);
512 m_kwl->
add( DEGREES_X_KW.c_str(), tempDouble1 );
513 m_kwl->
add( DEGREES_Y_KW.c_str(), tempDouble1 );
515 else if (num_params == 2)
517 ap.
read(
"--degrees", doubleParam1, doubleParam2);
518 m_kwl->
add( DEGREES_X_KW.c_str(), tempDouble1 );
519 m_kwl->
add( DEGREES_Y_KW.c_str(), tempDouble2 );
522 if ( ap.
read(
"--elevation", stringParam1) )
527 if ( ap.
read(
"-e", stringParam1) || ap.
read(
"--entry", stringParam1) )
532 if (ap.
read(
"--exaggeration", stringParam1))
537 if (ap.
read(
"--fullres-xys", stringParam1))
541 std::vector<ossimString> values;
544 if(values.size() > 2)
546 sx = values[2].toDouble();
548 if(values.size() > 3)
550 sy = values[3].toDouble();
552 m_kwl->
add(IMAGE_SPACE_SCALE_X_KW.c_str(), sx);
553 m_kwl->
add(IMAGE_SPACE_SCALE_Y_KW.c_str(), sy);
557 if ( ap.
read(
"--hemisphere", stringParam1) )
562 if ( ap.
read(
"--histogram-aoi", stringParam1) )
567 if(ap.
read(
"--enable-null-pixel-flip"))
572 if ( ap.
read(
"--histogram-center-tile" ) )
577 if ( ap.
read(
"--histogram-llwh", stringParam1) )
582 if ( ap.
read(
"--histogram-op", stringParam1) )
587 if ( ap.
read(
"--image-space-scale", doubleParam1, doubleParam2) )
589 m_kwl->
add( IMAGE_SPACE_SCALE_X_KW.c_str(), tempDouble1 );
590 m_kwl->
add( IMAGE_SPACE_SCALE_Y_KW.c_str(), tempDouble2 );
593 while( ap.
read(
"--input-dem", stringParam1) )
603 while( ap.
read(
"--input-img", stringParam1) )
613 if( ap.
read(
"--input-src", stringParam1) )
618 if( ap.
read(
"--meters", stringParam1) )
623 if ( ap.
read(
"-n") || ap.
read(
"--north-up") )
628 if( ap.
read(
"--op", stringParam1) )
636 if( ap.
read(
"--options", stringParam1) )
639 if ( optionsKwl.
exists() )
643 std::string errMsg =
"ERROR could not open options keyword list file: ";
644 errMsg += optionsKwl.
string();
650 std::string errMsg =
"ERROR options keyword list file does not exists: ";
651 errMsg += optionsKwl.
string();
656 if( ap.
read(
"--origin-latitude", stringParam1) )
661 if(ap.
read(
"--output-radiometry", stringParam1))
666 if ( ap.
read(
"--pad-thumbnail", stringParam1) )
671 if( ap.
read(
"--projection", stringParam1) )
676 if( ap.
read(
"--resample-filter", stringParam1) )
681 if ( ap.
read(
"-r", stringParam1) || ap.
read(
"--rotate", stringParam1) )
686 while (ap.
read(
"--reader-prop", stringParam1))
688 key = READER_PROPERTY_KW;
694 if ( ap.
read(
"--rrds", stringParam1) )
699 if ( ap.
read(
"--scale-to-8-bit") )
704 if ( ap.
read(
"--sharpen-mode", stringParam1) )
709 if ( ap.
read(
"--snap-tie-to-origin") )
714 if( ap.
read(
"--srs", stringParam1) )
724 if( ap.
read(
"-t", stringParam1) || ap.
read(
"--thumbnail", stringParam1) )
729 if ( ap.
read(
"--three-band-out") )
734 if( ap.
read(
"--tile-size", stringParam1) )
739 if ( ap.
read(
"-u") || ap.
read(
"--up-is-up") )
744 if( ap.
read(
"-w", stringParam1) || ap.
read(
"--writer", stringParam1) )
749 while (ap.
read(
"--writer-prop", stringParam1))
751 key = WRITER_PROPERTY_KW;
757 if( ap.
read(
"--zone", stringParam1) )
762 if( ap.
read(
"--2cmv-old-input-band", stringParam1) )
764 m_kwl->
addPair( TWOCMV_OLD_INPUT_BAND_KW, tempString1 );
767 if( ap.
read(
"--2cmv-new-input-band", stringParam1) )
769 m_kwl->
addPair( TWOCMV_NEW_INPUT_BAND_KW, tempString1 );
771 if( ap.
read(
"--2cmv-red-output-source", stringParam1) )
773 m_kwl->
addPair( TWOCMV_RED_OUTPUT_SOURCE_KW, tempString1 );
776 if( ap.
read(
"--2cmv-green-output-source", stringParam1) )
778 m_kwl->
addPair( TWOCMV_GREEN_OUTPUT_SOURCE_KW, tempString1 );
781 if( ap.
read(
"--2cmv-blue-output-source", stringParam1) )
783 m_kwl->
addPair( TWOCMV_BLUE_OUTPUT_SOURCE_KW, tempString1 );
785 if(ap.
read(
"--combiner-type", stringParam1))
794 std::string errMsg =
"Unknown option...";
798 if ( ap.
argc() >= 2 )
808 std::string errMsg =
"Must supply an output file.";
816 while ( pos < (ap.
argc()-1) )
822 <<
"argv[" << pos <<
"]: " << file <<
"\n";
836 if (
m_kwl->
find( SRC_FILE_KW.c_str() ) )
838 std::string errMsg = MODULE;
839 errMsg +=
"ERROR Multiple src files passed in. Please combine into one.";
885 static const char MODULE[] =
"ossimChipperUtil::initialize()";
892 if ( traceOptions() )
897 optionsFile +=
"-options.kwl";
898 ossimString comment =
" Can be use for --options argument.";
913 else if ( s ==
"hillshade" )
918 else if ( s ==
"color-relief" )
922 else if ( s ==
"ortho" )
926 else if ( s ==
"psm" )
930 else if ( s ==
"2cmv" )
936 std::string errMsg =
"unknown operation: ";
943 std::string errMsg =
"keyword not found: ";
945 errMsg +=
"\nUse --op option to specify operation.\n";
961 errMsg << op <<
" operation takes one input.";
971 errMsg << op <<
" operation requires two inputs.";
983 option = UP_IS_UP_KW;
984 ++rotationOptionCount;
988 option = NORTH_UP_KW;
989 ++rotationOptionCount;
993 option = ROTATION_KW;
994 ++rotationOptionCount;
998 if ( rotationOptionCount > 1 )
1003 errMsg << UP_IS_UP_KW <<
" is on.\n";
1007 errMsg << NORTH_UP_KW <<
" is on.\n";
1011 errMsg << ROTATION_KW <<
" is on.\n";
1013 errMsg <<
"Multiple rotation options do not make sense!";
1021 errMsg << option <<
" option takes one input.";
1028 errMsg << option <<
" option only valid with \"chip\" operation.";
1045 <<
"options keyword list:\n" 1051 <<
"support record keyword list:\n" 1062 static const char MODULE[] =
"ossimChipperUtil::initializeChain";
1095 if ( source.
valid() )
1155 source = cutter.
get();
1162 if ( result.
valid() )
1164 source = result.
get();
1186 static const char MODULE[] =
"ossimChipperUtil::initializeBumpShadeChain";
1213 if ( lookup.
size() )
1225 << MODULE <<
" WARNING:" 1226 <<
"\nBoth a color table and image(s) have been provided for a color source.\n" 1227 <<
"Choosing color table of image(s).\n";
1244 if ( lookup.
size() )
1247 if ( (f >= 0) && (f <= 360) )
1257 if ( lookup.
size() )
1260 if ( (f >= 0.0) && (f <= 90) )
1274 if ( lookup.
size() )
1279 if ( lookup.
size() )
1284 if ( lookup.
size() )
1302 <<
"\nazimuthAngle: " << azimuthAngle
1303 <<
"\nelevation angle: " << elevationAngle
1304 <<
"\ngain factor: " << gain
1305 <<
"\nr: " << int(r)
1306 <<
"\ng: " << int(g)
1307 <<
"\nb: " << int(b)
1312 source = bumpShade.
get();
1343 if ( layerCount == 2 )
1361 if ( !input1.
valid() )
1366 if ( !input2.
valid() )
1398 std::vector<ossim_uint32> bandList(1);
1435 static const char MODULE[] =
"ossimChipperUtil::execute";
1491 throw ossimException(
"Unable to initialize writer for execution" );
1514 if( optionsKwl.
getSize() > 0 )
1531 if ( optionsKwl.
getSize() > 0 )
1555 static const char MODULE[] =
"ossimChipperUtil::addDemSources";
1562 std::vector<ossimString> sortedList;
1564 for(
auto record:sortedList)
1596 for(
auto record:sortedList)
1615 static const char MODULE[] =
"ossimChipperUtil::addDemSource(const ossimFilename&)";
1636 static const char MODULE[] =
"ossimChipperUtil::addDemSource(const ossimSrcRecord&)";
1657 static const char MODULE[] =
"ossimChipperUtil::addImgSources";
1663 std::vector<ossimString> sortedList;
1665 for(
auto record:sortedList)
1672 std::shared_ptr<ossimSrcRecord> srcRecord = std::make_shared<ossimSrcRecord>();
1673 if(srcRecord->loadState(*
m_kwl, imagePrefix.
c_str()))
1683 for(
auto record:sortedList)
1686 std::shared_ptr<ossimSrcRecord> src = std::make_shared<ossimSrcRecord>();
1687 if ( src->loadState( *(
m_srcKwl.
get()), prefix ) )
1702 static const char MODULE[] =
"ossimChipperUtil::addImgSource";
1707 << MODULE <<
" entered...\nFile: " << file <<
"\n";
1724 static const char MODULE[] =
"ossimChipperUtil::addImgSource(const ossimSrcRecord&)";
1745 bool isDemSource)
const 1747 static const char MODULE[] =
"ossimChipperUtil::createChain(const ossimFilename&";
1752 << MODULE <<
" entered..." 1753 <<
"\nfile: " << file
1754 <<
"\nentry: " << entryIndex
1755 <<
"\nisDemSource: " << (isDemSource?
"true":
"false")
1764 if ( ic->
open( file ) )
1777 errMsg << MODULE <<
" ERROR:\nEntry " << entryIndex <<
" out of range!" 1786 bool psmPanInput =
false;
1809 std::vector<ossim_uint32> bandList(0);
1811 if ( bandList.size() )
1823 if(nullPixelFlip.
toBool())
1849 if ( ( isDemSource ==
false ) ||
1862 if ( sharpnessMode.size() )
1872 if ( lookup.
size() )
1897 if ( sharpnessMode.size() )
1899 if ( sharpnessMode ==
"light" )
1903 else if ( sharpnessMode ==
"heavy" )
1913 if(polygon.
size()>0)
1927 std::string errMsg =
"Could not open: ";
1938 <<
"chain:\n" << kwl <<
"\n" 1939 << MODULE <<
" exiting...\n";
1946 bool isDemSource)
const 1948 static const char MODULE[] =
"ossimChipperUtil::createChain(const ossimSrcRecord&)";
1955 if ( ic->
open(rec) )
1966 bool psmPanInput =
false;
1989 std::vector<ossim_uint32> bandList(0);
1991 if ( bandList.size() )
2002 if (nullPixelFlip.
toBool())
2029 if ( ( isDemSource ==
false ) ||
2042 if ( sharpnessMode.size() )
2057 if ( lookup.
size() )
2082 if ( sharpnessMode.size() )
2084 if ( sharpnessMode ==
"light" )
2088 else if ( sharpnessMode ==
"heavy" )
2098 if(polygon.
size()>0)
2106 std::string errMsg =
"Could not open from src record!";
2116 <<
"chain:\n" << kwl <<
"\n" 2117 << MODULE <<
" exiting...\n";
2125 static const char MODULE[] =
"ossimChipperUtil::createOutputProjection";
2135 if ( op.size() && srs.size() )
2138 << MODULE <<
" WARNING:" 2140 <<
" keywords are set!" 2142 <<
"\noutput_projection: " << op
2143 <<
"\nTaking " << srs <<
" over " << op <<
"\n";
2146 bool usingInput =
false;
2155 else if ( op.size() )
2191 if ( *(inputProj.
get()) == *(proj.
get()) )
2212 if ( !proj.
valid() )
2215 if ( inputProj.
valid() )
2222 <<
"WARNING: No projection set!" 2223 <<
"\nDefaulting to first input's projection.\n";
2232 <<
"WARNING: No projection set!" 2233 <<
"\nDefaulting to scaled geographic at scene center.\n";
2264 <<
"using input projection: " << (usingInput?
"true":
"false")
2265 <<
"\noutput image geometry:\n";
2276 static const char MODULE[] =
"ossimChipperUtil::createIdentityProjection";
2324 <<
"WARNING: No projection to compute the up is up angle!" << std::endl;
2337 <<
"WARNING: No projection to compute the North up angle!" << std::endl;
2364 <<
"\nAffine transform parameters:" 2365 <<
"\nrotation: " << rotation
2366 <<
"\nmid point: " << midPt << std::endl;
2374 midPt.
x*imageSpaceScale.
x,
2375 midPt.
y*imageSpaceScale.
y);
2406 if ( lookup.
size() )
2414 if ( lookup.
size() )
2427 scale.
x = inputDpp.
x/outputDpp.
x;
2428 scale.
y = inputDpp.
y/outputDpp.
y;
2436 if ( lookup.
size() )
2441 outputMpp.
y = outputMpp.
x;
2451 scale.
x = inputMpp.
x/outputMpp.
x;
2452 scale.
y = inputMpp.
y/outputMpp.
y;
2461 if ( lookup.
size() )
2470 scale.
x = 1.0 / std::pow(2.0, d);
2482 std::string errMsg =
"ossimChipperUtil::initializeIvtScale failed!";
2492 static const char MODULE[] =
"ossimChipperUtil::initializeProjectionTiePoint()";
2501 if ( mapProj.
valid() )
2521 tiePoint.
lat -= half_pixel_shift.
lat;
2522 tiePoint.
lon += half_pixel_shift.
lon;
2527 std::string errMsg = MODULE;
2528 errMsg +=
" tie point has nans!";
2535 <<
"projection tie point: " << tiePoint <<
"\n" << MODULE <<
" exited...\n";
2556 tiePoint.
y -= half_pixel_shift.
y;
2557 tiePoint.
x += half_pixel_shift.
x;
2562 std::string errMsg = MODULE;
2563 errMsg +=
" tie point has nans!";
2570 <<
"projection tie point: " << tiePoint <<
"\n" << MODULE <<
" exited...\n";
2577 std::string errMsg = MODULE;
2578 errMsg +=
"m_projection is null!";
2585 static const char MODULE[] =
"ossimChipperUtil::initializeProjectionGsd()";
2592 if ( !mapProj.
valid() )
2594 std::string errMsg = MODULE;
2595 errMsg +=
" projection is null!";
2612 if ( degreesX.
size() || degreesY.
size() || meters.
size() )
2615 errMsg << MODULE <<
" ERROR: Ambiguous scale keywords!\n" 2616 <<
"Do not combine meters or degrees with cut box with a width and height.\n";
2632 if ( cutMinLat.
size() && cutMinLon.
size() && cutMaxLat.
size() &&
2633 cutMaxLon.
size() && cutWidth.
size() && cutHeight.
size() )
2644 gsd.
x = std::fabs( maxLon - minLon ) / width;
2645 gsd.
y = std::fabs( maxLat - minLat ) / height;
2662 std::vector<ossimString> cutBox = cutWmsBbox.
split(
",");
2663 if(cutBox.size()==4)
2671 gsd.
x = std::fabs( maxx - minx ) / width;
2672 gsd.
y = std::fabs( maxy - miny ) / height;
2688 errMsg << MODULE <<
" ERROR: cut box does not have 4 values!\n";
2694 if ( meters.
size() && ( degreesX.
size() || degreesY.
size() ) )
2697 errMsg << MODULE <<
" ERROR: Ambiguous scale keywords!\n" 2698 <<
"Do not combine meters with degrees.\n";
2702 if ( degreesX.
size() )
2707 if ( degreesY.
size() )
2716 else if ( meters.
size() )
2748 <<
"projection gsd: " << gsd <<
"\n" << MODULE <<
" exited...\n";
2754 static const char MODULE[] =
"ossimChipperUtil::getTiePoint(ossimGpt&)";
2760 std::vector< ossimRefPtr<ossimSingleImageChain> >::iterator chainIdx;
2774 tie = chainTiePoint;
2778 if ( chainTiePoint.
lat > tie.
lat )
2780 tie.
lat = chainTiePoint.
lat;
2782 if ( chainTiePoint.
lon < tie.
lon )
2784 tie.
lon = chainTiePoint.
lon;
2797 tie = chainTiePoint;
2801 if ( chainTiePoint.
lat > tie.
lat )
2803 tie.
lat = chainTiePoint.
lat;
2805 if ( chainTiePoint.
lon < tie.
lon )
2807 tie.
lon = chainTiePoint.
lon;
2816 <<
"tie point: " << tie <<
"\n" << MODULE <<
" exited...\n";
2822 static const char MODULE[] =
"ossimChipperUtil::getTiePoint(ossimSingleImageChain*,ossimGpt&)";
2850 std::string errMsg = MODULE;
2851 errMsg +=
"\ngeom->localToWorld returned nan for chain.";
2852 errMsg +=
"\nChain: ";
2859 std::string errMsg = MODULE;
2860 errMsg +=
"\nNo geometry for chain: ";
2867 std::string errMsg = MODULE;
2868 errMsg +=
" ERROR: Null chain passed to method!";
2876 <<
"\ntie point: " << tie <<
"\n" 2877 << MODULE <<
" exited...\n";
2883 static const char MODULE[] =
"ossimChipperUtil::getTiePoint(ossimDpt&)";
2889 std::vector< ossimRefPtr<ossimSingleImageChain> >::iterator chainIdx;
2901 tie = chainTiePoint;
2905 if ( chainTiePoint.
y > tie.
y )
2907 tie.
y = chainTiePoint.
y;
2909 if ( chainTiePoint.
x < tie.
x )
2911 tie.
x = chainTiePoint.
x;
2924 tie = chainTiePoint;
2928 if ( chainTiePoint.
y > tie.
y )
2930 tie.
y = chainTiePoint.
y;
2932 if ( chainTiePoint.
x < tie.
x )
2934 tie.
x = chainTiePoint.
x;
2943 <<
"tie point: " << tie <<
"\n" << MODULE <<
" exited...\n";
2949 static const char MODULE[] =
"ossimChipperUtil::getTiePoint(ossimSingleImageChain*,ossimDpt&)";
2973 std::string errMsg = MODULE;
2974 errMsg +=
"\ngeom->localToWorld returned nan for chain.";
2975 errMsg +=
"\nChain: ";
2982 std::string errMsg = MODULE;
2983 errMsg +=
"\nNo geometry for chain: ";
2990 std::string errMsg = MODULE;
2991 errMsg +=
" ERROR: Null chain passed to method!";
2999 <<
"\ntie point: " << tie <<
"\n" 3000 << MODULE <<
" exited...\n";
3006 static const char MODULE[] =
"ossimChipperUtil::getMetersPerPixel(ossimDpt&)";
3015 std::vector< ossimRefPtr<ossimSingleImageChain> >::iterator chainIdx;
3022 if ( gsd.
hasNans() || ( chainGsd.
x < gsd.
x ) )
3034 if ( gsd.
hasNans() || ( chainGsd.
x < gsd.
x ) )
3044 <<
"gsd: " << gsd <<
"\n" << MODULE <<
" exited...\n";
3050 static const char MODULE[] =
"ossimChipperUtil::getMetersPerPixel(ossimSingleImageChain*,ossimDpt&)";
3064 std::string errMsg = MODULE;
3065 errMsg +=
"\ngeom->getMetersPerPixel returned nan for chain.";
3066 errMsg +=
"\nChain: ";
3073 std::string errMsg = MODULE;
3074 errMsg +=
"\nNo geometry for chain: ";
3081 std::string errMsg = MODULE;
3082 errMsg +=
" ERROR: Null chain passed to method!";
3090 <<
"\nmeters per pixel: " << gsd <<
"\n" << MODULE <<
" exited...\n";
3098 if ( lookup.
size() )
3101 if ( (result < -180.0) || (result > 180.0) )
3103 std::string errMsg =
"central meridian range error!";
3104 errMsg +=
" Valid range: -180 to 180";
3115 if ( lookup.
size() )
3118 if ( (result < -90) || (result > 90.0) )
3120 std::string errMsg =
"origin latitude range error!";
3121 errMsg +=
" Valid range: -90 to 90";
3130 static const char MODULE[] =
"ossimChipperUtil::getSceneCenter(ossimGpt&)";
3136 std::vector<ossimGpt> centerGptArray;
3139 std::vector< ossimRefPtr<ossimSingleImageChain> >::iterator chainIdx;
3148 centerGptArray.push_back( centerGpt );
3160 centerGptArray.push_back( centerGpt );
3168 std::vector<ossimGpt>::const_iterator pointIdx = centerGptArray.begin();
3169 while ( pointIdx != centerGptArray.end() )
3171 lat += (*pointIdx).lat;
3172 lon += (*pointIdx).lon;
3176 lat /= centerGptArray.size();
3177 lon /= centerGptArray.size();
3179 if ( (lat >= -90.0) && (lat <= 90.0) && (lon >= -180.0) && (lon <= 180.0) )
3187 errMsg << MODULE <<
" range error!\nlatitude = " 3197 <<
"scene center: " << gpt <<
"\n" << MODULE <<
" exited...\n";
3203 static const char MODULE[] =
3204 "ossimChipperUtil::getSceneCenter(const ossimSingleImageChain*,ossimGpt&)";
3223 std::string errMsg = MODULE;
3224 errMsg +=
"\ngeom->localToWorld returned nan for chain.";
3225 errMsg +=
"\nChain: ";
3232 std::string errMsg = MODULE;
3233 errMsg +=
"\nNo geometry for chain: ";
3240 std::string errMsg = MODULE;
3241 errMsg +=
" ERROR: Null chain passed to method!";
3249 <<
"\nscene center: " << gpt <<
"\n" 3250 << MODULE <<
" exited...\n";
3256 static const char MODULE[] =
"ossimChipperUtil::getFirstInputProjection";
3292 if ( !result.
valid() && traceDebug() )
3297 else if ( traceDebug() )
3303 else if ( traceDebug() )
3310 if ( result.
valid() )
3356 std::string errMsg =
"ossimChipperUtil::getNewGeoScaledProjection ERROR";
3357 errMsg +=
"\nOrigin has nans!";
3365 const std::string& code)
3372 if ( ( os ==
"epsg:4326" ) || ( code ==
"4326" ) )
3380 createProjection(code);
3395 bool setZone =
false;
3397 if ( (zone > 0 ) && ( zone < 61 ) )
3404 bool setHemisphere =
false;
3406 if ( hemisphere.size() )
3410 if ( ( h ==
"N" ) || ( h ==
"NORTH" ) )
3414 setHemisphere =
true;
3416 if ( ( h ==
"S" ) || ( h ==
"SOUTH" ) )
3420 setHemisphere =
true;
3424 if ( !setZone || !setHemisphere )
3444 if ( !setHemisphere )
3451 std::string errMsg =
"ossimChipperUtil::getNewUtmProjection ERROR";
3452 errMsg +=
"\nOrigin has nans!";
3472 static const char MODULE[] =
"ossimChipperUtil::createNewWriter()";
3483 std::string errMsg = MODULE;
3484 errMsg +=
" ERROR no output file name!";
3491 if ( lookup.
size() )
3494 if ( !writer.
valid() )
3496 std::string errMsg = MODULE;
3497 errMsg +=
" ERROR creating writer: ";
3498 errMsg += lookup.
string();
3505 createWriterFromExtension( outputFile.
ext() );
3507 if ( !writer.
valid() )
3509 std::string errMsg = MODULE;
3510 errMsg +=
" ERROR creating writer from extension: ";
3526 if ( lookup.
size() )
3528 std::vector<ossimString> splitArray;
3529 lookup.
split(splitArray,
"=");
3530 if(splitArray.size() == 2)
3538 <<
"Setting writer prop: " << splitArray[0] <<
"=" << splitArray[1] <<
"\n";
3548 if ( lookup.
size() )
3552 if ( (tileSize.
x % 16) == 0 )
3554 tileSize.
y = tileSize.
x;
3557 else if ( traceDebug() )
3560 << MODULE <<
" NOTICE:" 3561 <<
"\nTile width must be a multiple of 16! Using default.." 3570 << MODULE <<
" exited...\n";
3578 static const char MODULE[] =
"ossimChipperUtil::propagateOutputProjectionToChains()";
3584 std::vector< ossimRefPtr<ossimSingleImageChain> >::iterator chainIdx;
3595 viewVisitor.reset();
3596 eventVisitor.reset();
3597 (*chainIdx)->accept(viewVisitor);
3598 (*chainIdx)->accept(eventVisitor);
3601 if ( resampler.
valid() )
3608 std::string errMsg = MODULE;
3609 errMsg +=
" chain has no resampler!";
3620 eventVisitor.reset();
3621 viewVisitor.reset();
3622 (*chainIdx)->
accept(viewVisitor);
3623 (*chainIdx)->accept(eventVisitor);
3625 if ( resampler.
valid() )
3632 std::string errMsg = MODULE;
3633 errMsg +=
" chain has no resampler!";
3648 static const char MODULE[] =
"ossimChipperUtil::combineLayers(layers)";
3656 if ( layers.size() == 1 )
3658 result = layers[0].
get();
3660 else if ( layers.size() > 1 )
3665 std::vector< ossimRefPtr<ossimSingleImageChain> >::iterator chainIdx = layers.begin();
3666 while ( chainIdx != layers.end() )
3683 static const char MODULE[] =
"ossimChipperUtil::combineLayers()";
3695 if ( layerCount == 1 )
3713 std::vector< ossimRefPtr<ossimSingleImageChain> >::iterator chainIdx =
3723 std::vector< ossimRefPtr<ossimSingleImageChain> >::iterator chainIdx =
3750 if ( layerCount == 2 )
3775 if ( !oldImg.
valid() )
3780 if ( !newImg.
valid() )
3811 std::string key = TWOCMV_OLD_INPUT_BAND_KW;
3820 key = TWOCMV_NEW_INPUT_BAND_KW;
3828 key = TWOCMV_RED_OUTPUT_SOURCE_KW;
3839 else if ( os ==
"MIN" )
3845 key = TWOCMV_GREEN_OUTPUT_SOURCE_KW;
3856 else if ( os ==
"MIN" )
3862 key = TWOCMV_BLUE_OUTPUT_SOURCE_KW;
3873 else if ( os ==
"MIN" )
3887 result = tcmv.
get();
3898 static const char MODULE[] =
"ossimChipperUtil::addIndexToRgbLutFilter(source)";
3906 if ( source.
valid() )
3930 std::string errMsg = MODULE;
3931 errMsg +=
" color table does not exists: ";
3932 errMsg += lutFile.
string();
3938 std::string errMsg = MODULE;
3939 errMsg +=
" ERROR: Null source passed to method!";
3954 static const char MODULE[] =
"ossimChipperUtil::addScalarRemapper(source)";
3962 if ( source.
valid() )
3969 result = remapper.
get();
3974 <<
"\nOutput remapped to: " 3985 std::string errMsg = MODULE;
3986 errMsg +=
" ERROR: Null source passed to method!";
3993 << MODULE <<
" exited...\n";
4002 static const char MODULE[] =
"ossimChipperUtil::addAnnotations(source)";
4012 ossimString regularExpression =
"annotation[0-9]*\\.type";
4025 std::string prefixBase =
"annotation";
4029 while ( (found < COUNT) && ( i < (COUNT+100) ) )
4038 if ( value ==
"cross_hair" )
4049 result = annotator.
get();
4054 std::string errMsg = MODULE;
4055 errMsg +=
" ERROR: Null source passed to method!";
4070 if ( annotator.
valid() && prefix.size() )
4072 std::string linePrefix = prefix + std::string(
"line.");
4073 std::string textPrefix = prefix + std::string(
"text.");
4081 std::string key =
"location";
4085 if (value ==
"scene_center")
4088 centerPt = boundingRect.
midPoint();
4093 key =
"location.gpt";
4116 if ( centerPt.
hasNans() == false )
4133 start.
x = centerPt.
x;
4134 start.
y = centerPt.
y-halfLine;
4136 end.
y = centerPt.
y+halfLine;
4148 start.
x = centerPt.
x-halfLine;
4149 start.
y = centerPt.
y;
4150 end.
x = centerPt.
x+halfLine;
4193 if ( value ==
"bottom" )
4202 ipt.
x = ipt.
x - rect.
width()/2;
4215 std::shared_ptr<ossimSrcRecord> srcRecordPtr)
const 4217 static const char MODULE[] =
"ossimChipperUtil::setupChainHistogram(chain)";
4223 bool result =
false;
4228 if ( chain.
valid() )
4238 if(histCenterKw.
empty())
4240 histCenterKw =
"false";
4247 bool openedHistogram =
false;
4253 f = srcRecordPtr->getHistogramPath();
4270 if ( !openedHistogram && traceDebug() )
4273 << MODULE <<
" WARNING:" 4274 <<
"\nCould not open: " << f <<
"\n";
4278 if ( !openedHistogram )
4308 result =
getIrect( chain, value, aoi );
4319 <<
"ROI of histogram: " << aoi << std::endl;
4360 bool result =
false;
4361 if ( chain.
valid() )
4379 static const char MODULE[] =
"ossimChipperUtil::getAreaOfInterest()";
4395 std::string cutBbox =
m_kwl->
findKey( CUT_BBOX_XYWH_KW );
4410 std::vector<ossimString> values;
4411 tempFullXys.
split(values,
",");
4418 if (values.size() > 2)
4420 location.
x = values[0].toDouble();
4421 location.
y = values[1].toDouble();
4427 ossimIpt ul(ossim::round<int>(mid.
x - (w / 2)),
4428 ossim::round<int>(mid.
y - (h / 2)));
4439 if (
m_kwl->
find( CUT_CENTER_LAT_KW.c_str() ) )
4445 if ( latStr.
size() && lonStr.
size() )
4476 if ( widthStr.
size() && heightStr.
size() )
4480 if ( width && height )
4482 ossimIpt ul( ossim::round<int>(centerDpt.
x - (width/2)),
4483 ossim::round<int>(centerDpt.
y - (height/2)) );
4484 ossimIpt lr( (ul.
x + width - 1), ul.
y + height - 1);
4491 if ( radiusStr.
size() )
4504 ossimIpt ul( ossim::round<int>( centerDpt.
x - rx ),
4505 ossim::round<int>( centerDpt.
y - ry ) );
4506 ossimIpt lr( ossim::round<int>( centerDpt.
x + rx ),
4507 ossim::round<int>( centerDpt.
y + ry ) );
4521 else if ( (
m_kwl->
find( CUT_MAX_LAT_KW.c_str() ) ||
4522 (
m_kwl->
find( CUT_WMS_BBOX_LL_KW.c_str() ))))
4530 if(
m_kwl->
find( CUT_MAX_LAT_KW.c_str() ))
4542 std::vector<ossimString> cutBox = cutBbox.
split(
",");
4543 if(cutBox.size() >3)
4563 if ( minLatF > maxLatF )
4577 halfDpp = halfDpp/2.0;
4584 gpt.
lat = maxLatF - halfDpp.
y;
4585 gpt.
lon = minLonF + halfDpp.
x;
4589 gpt.
lat = minLatF + halfDpp.
y;
4590 gpt.
lon = maxLonF - halfDpp.
x;
4609 else if (
m_kwl->
find( CUT_WMS_BBOX_KW.c_str() ) )
4614 std::vector<ossimString> cutBox = cutBbox.
split(
",");
4615 if(cutBox.size()==4)
4626 std::vector<ossimDpt> pts(4);
4632 halfDpp = halfDpp/2.0;
4639 gpt.
lat = maxy - halfDpp.
y;
4640 gpt.
lon = minx + halfDpp.
x;
4643 gpt.
lat = maxy - halfDpp.
y;
4644 gpt.
lon = maxx - halfDpp.
x;
4648 gpt.
lat = miny + halfDpp.
y;
4649 gpt.
lon = maxx - halfDpp.
x;
4653 gpt.
lat = miny + halfDpp.
y;
4654 gpt.
lon = minx + halfDpp.
x;
4667 halfMpp = halfMpp/2.0;
4669 eastingNorthing.
x = minx+halfMpp.
x;
4670 eastingNorthing.
y = miny+halfMpp.
y;
4672 eastingNorthing.
x = minx+halfMpp.
x;
4673 eastingNorthing.
y = maxy-halfMpp.
y;
4675 eastingNorthing.
x = maxx-halfMpp.
x;
4676 eastingNorthing.
y = maxy-halfMpp.
y;
4678 eastingNorthing.
x = maxx-halfMpp.
x;
4679 eastingNorthing.
y = miny+halfMpp.
y;
4691 std::string errMsg = MODULE;
4694 errMsg +=
" image source null!";
4698 errMsg +=
" output projection null!";
4717 <<
"aoi: " << rect <<
"\n" 4718 << MODULE <<
" exited...\n";
4725 bool result =
false;
4730 std::vector<ossimString> keys;
4731 cutBbox.
split(keys,
",");
4732 if( keys.size() > 3 )
4736 ul.
x = keys[0].toInt32();
4737 ul.
y = keys[1].toInt32();
4738 lr.
x = ul.
x + keys[2].toInt32() - 1;
4739 lr.
y = ul.
y + keys[3].toInt32() - 1;
4748 const std::string& s,
4751 bool result =
false;
4753 if ( chain.
valid() )
4764 std::vector<ossimString> keys;
4765 cutBbox.
split(keys,
",");
4766 if( keys.size() > 3 )
4769 gpt.
lat = keys[0].toFloat64();
4770 gpt.
lon = keys[1].toFloat64();
4792 bool result =
false;
4793 if ( chain.
valid() )
4817 static const char MODULE[] =
"ossimChipperUtil::initializeThumbnailProjection";
4821 << MODULE <<
" entered...\n" 4822 <<
"origial rect: " << originalRect <<
"\n";
4836 if ( thumbRes.
size() )
4844 if ( maxRectDimension > thumbSize )
4857 scale = thumbSize / maxRectDimension;
4869 scale = maxRectDimension / thumbSize;
4903 lr.
x = ul.
x + ts - 1;
4904 lr.
y = ul.
y + ts - 1;
4908 lr.
x = ul.
x + tw - 1;
4909 lr.
y = ul.
y + th - 1;
4920 std::string errMsg = MODULE;
4923 errMsg +=
" passed in rect has nans!";
4927 errMsg +=
" output projection null!";
4945 bool result =
false;
4955 bool result =
false;
4970 bool result =
false;
5002 bool result =
false;
5038 std::vector<ossimString> splitArray;
5039 value.
split(splitArray,
"=");
5040 if(splitArray.size() == 2)
5059 if ( os.
size() &&(os!=
"default"))
5061 std::vector<ossimString> band_list(0);
5063 if ( band_list.size() )
5065 std::vector<ossimString>::const_iterator i = band_list.begin();
5066 while ( i != band_list.end() )
5071 bandList.push_back( band - 1 );
5083 bool result =
false;
5086 ossimString regularExpression =
"annotation[0-9]*\\.type";
5098 bool result =
false;
5101 result = (
m_kwl->
find( LUT_FILE_KW.c_str() ) != 0 );
5108 bool result =
false;
5127 bool result = (
m_kwl->
find(CLIP_WMS_BBOX_LL_KW.c_str())||
5128 m_kwl->
find(CLIP_POLY_LAT_LON_KW.c_str()));
5140 m_kwl->
find( COLOR_GREEN_KW.c_str() ) ||
5150 bool result =
false;
5153 result = (
m_kwl->
find( THUMBNAIL_RESOLUTION_KW.c_str() ) != 0 );
5160 bool result =
false;
5170 bool result =
false;
5172 if ( ext.
size() >= 2 )
5175 if ( ( ext ==
"hgt" ) || ( ext ==
"dem" ) ||
5176 ( ( (*ext.
begin()) ==
'd' ) && ( (*(ext.
begin()+1)) ==
't' ) ) )
5186 bool result =
false;
5200 if ( lookup.
size() )
5207 if (
keyIsTrue( std::string(SCALE_2_8_BIT_KW) ) )
5217 bool result =
false;
5227 return keyIsTrue( SNAP_TIE_TO_ORIGIN_KW );
5232 imageSpaceScale.
x = 1.0;
5233 imageSpaceScale.
y = 1.0;
5239 std::vector<ossimString> values;
5241 if (values.size() > 2)
5243 imageSpaceScale.
x = values[2].toDouble();
5244 imageSpaceScale.
y = imageSpaceScale.
x;
5245 if (values.size() > 3)
5247 imageSpaceScale.
y = values[3].toDouble();
5253 std::string value =
m_kwl->
findKey(IMAGE_SPACE_SCALE_X_KW);
5260 imageSpaceScale.
x = 1.0;
5269 imageSpaceScale.
y = 1.0;
5281 std::vector<ossimString> values;
5284 if(values.size() > 1)
5286 imageSpacePivot.
x = values[0].toDouble();
5287 imageSpacePivot.
y = values[1].toDouble();
5316 if ( ( result < 0.0 ) || ( result > 360.0 ) )
5319 errMsg <<
"ossimChipperUtil::getRotation range error!\n" 5320 <<
"rotation = " << result
5321 <<
"\nMust be between 0 and 360.";
5331 return keyIsTrue( std::string(UP_IS_UP_KW) );
5336 bool result =
false;
5337 std::string value =
m_kwl->
findKey(std::string(ROTATION_KW));
5347 return keyIsTrue( std::string(NORTH_UP_KW) );
5357 bool result =
false;
5410 bool result =
false;
5413 std::vector< ossimRefPtr<ossimSingleImageChain> >::iterator chainIdx =
m_imgLayer.begin();
5478 static const char MODULE[] =
"ossimChipperUtil::initializeSrcKwl";
5482 << MODULE <<
" entered...\n";
5485 std::string value =
m_kwl->
findKey(std::string(SRC_FILE_KW));
5505 <<
"src keyword list:\n" << *(
m_srcKwl.
get()) <<
"\n";
5508 << MODULE <<
" exited...\n";
5552 else if (os ==
"geo-scaled")
5556 else if ( os ==
"input" )
5560 else if ( (os ==
"utm") || (os ==
"ossimutmprojection") )
5580 param =
m_kwl->
find(CLIP_POLY_LAT_LON_KW.c_str());
5583 std::vector<ossimGpt> points;
5602 if ( ( brightness < -1.0 ) || ( brightness > 1.0 ) )
5605 <<
"ossimChipperUtil::getBrightness range error!" 5606 <<
"\nbrightness: " << brightness
5607 <<
"\nvalid range: -1.0 to 1.0" 5608 <<
"\nReturned brightness has been reset to: 0.0" 5627 if ( ( contrast < 0.0 ) || ( contrast > 20.0 ) )
5630 <<
"ossimChipperUtil::getContrast range error!" 5631 <<
"\ncontrast: " << contrast
5632 <<
"\nvalid range: 0 to 20.0" 5633 <<
"\nReturned contrast has been reset to: 1.0" 5649 if ( (mode !=
"light") && (mode !=
"heavy") && (mode !=
"none") )
5652 <<
"ossimChipperUtil::getSharpnessMode WARNING!" 5653 <<
"\nInvalid sharpness mode: " << mode
5654 <<
"\nValid modes: \"light\" and \"heavy\"" 5658 if(mode==
"none") mode =
"";
5670 if ( ( op.
string() ==
"auto-minmax" ) )
5674 else if ( ( op.
string() ==
"auto-percentile" ) )
5678 else if ( (op ==
"std-stretch-1") || (op ==
"std-stretch 1") )
5682 else if ( (op ==
"std-stretch-2") || (op ==
"std-stretch 2") )
5686 else if ( (op ==
"std-stretch-3") || (op ==
"std-stretch 3") )
5690 else if( traceDebug() )
5693 <<
"ossimChipperUtil::getHistoMode: Unhandled operation: " << op <<
"\n";
5718 <<
"1) Never use same base name in the same directory! Example is you have a Chicago.tif\n" 5719 <<
" and you want a Chicago.jp2, output Chicago.jp2 to its own directory.\n" 5721 <<
"\nExample commands:\n" 5723 <<
"\n// File conversion: Convert geotiff to a jp2 file.\n" 5724 << appName <<
" --op chip -w ossim_kakadu_jp2 Chicago.tif outputs/Chicago.jp2\n" 5726 <<
"\n// Orthorectification: Orthorectify a nitf with RPC model out to a geotiff.\n" 5727 << appName <<
" --op ortho 5V090205P0001912264B220000100282M_001508507.ntf outputs/ortho.tif\n" 5729 <<
"\n// Mosaic: Mosaic multiple images together and output to a geotiff.\n" 5730 << appName <<
" --combiner-type ossimImageMosaic --op ortho f1.tif f2.tif f3.tif outputs/mosaic.tif\n" 5732 <<
"\n// Mosaic: Feather Mosaic multiple images together and output to a geotiff.\n" 5733 << appName <<
" --combiner-type ossimFeatherMosaic --op ortho f1.tif f2.tif f3.tif outputs/feather.tif\n" 5735 <<
"\n// Color relief: Colorize two DEMs from a lut, output to a geotiff.\n" 5736 << appName <<
" --op color-relief --color-table ossim-dem-color-table-template.kwl N37W123.hgt N38W123.hgt outputs/color-relief.tif\n" 5738 <<
"\n// Color relief: Colorize two DEMs from a lut, output to a png thumbnail.\n" 5739 << appName <<
" --op color-relief --color-table ossim-dem-color-table-template.kwl -t 1024 -w ossim_png N37W123.hgt N38W123.hgt outputs/color-relief.png\n" 5741 <<
"\n// Hill shade: Hill shade two DEMs, output to a geotiff.\n" 5742 << appName <<
" --color 255 255 255 --azimuth 270 --elevation 45 --exaggeration 2.0 --op hillshade N37W123.hgt N38W123.hgt outputs/hillshade.tif\n" 5744 <<
"\n// Two color multi view with cut box. First image is old, second image is new:\n" 5745 << appName <<
" --cut-bbox-ll 28.092885092033352 -80.664539599998633 28.109128691071547 -80.626914963229325 --op 2cmv oldMLB.tif newMLB.tif outputs/2cmv-test1.tif\n" 5747 <<
"\n// Ortho about point, 512x512, with histogram stretch, and 3,2,1 band order:\n" 5748 << appName <<
" --op ortho -b 3,2,1 --histogram-op auto-minmax --cut-center-llwh -42.819784401784275 147.265811350983 512 512 5V090205M0001912264B220000100072M_001508507.ntf orth.tif\n" 5750 <<
"\n// Chip, in image space, about point, 512x512, with histogram stretch, and 3,2,1 band order:\n" 5751 << appName <<
" --op chip -b 3,2,1 --histogram-op auto-minmax --cut-center-llwh -42.819784401784275 147.265811350983 512 512 5V090205M0001912264B220000100072M_001508507.ntf chip.tif\n" 5753 <<
"\n// Chip in image space, rotate \"up is up\"(-u option) about point, 512x512 with histogram stretch and 3,2,1 band order:\n" 5754 << appName <<
" --op chip -u -b 3,2,1 --histogram-op auto-minmax --cut-center-llwh -42.819784401784275 147.265811350983 512 512 5V090205M0001912264B220000100072M_001508507.ntf up-is-up-chip.tif\n" 5756 <<
"\n// Chip in image space, rotate 39 degrees (-r option) about point, 1024x1024, scaled to eight bit:\n" 5757 << appName <<
" --op chip -r 39 --histogram-op auto-minmax --cut-center-llwh -42.883809539602893 147.331984112985765 1024 1024 --output-radiometry ossim_uint8 5V090205P0001912264B220000100282M_001508507.ntf outputs/r39.png\n" 5759 <<
"\n// Above command where all options are in a keyword list:\n" 5760 << appName <<
" --options r39-options.kwl\n" bool hasSensorModelInput()
std::string getSharpenMode() const
Gets the sharpen mode.
void setRectangle(const ossimIrect &rect)
ossimRefPtr< ossimImageSource > addIndexToRgbLutFilter(ossimRefPtr< ossimImageSource > &source) const
Creates ossimIndexToRgbLutFilter and connects to source.
bool hasAnnotations() const
Class used for parsing the command line *.src files.
void clear()
Erases the entire container.
ossimRefPtr< ossimImageSource > initializeChain(ossimIrect &aoi)
Builds image chains returns ref pointer to image source and initializes area of interest(aoi).
void write(std::ostream &output, const UsageMap &um, unsigned int widthOfOutput=80)
virtual void initialize()
void getSceneCenter(ossimGpt &gpt)
Loops through all layers to get the scene center ground point.
void getOutputFilename(ossimFilename &f) const
Gets the output file name.
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
This will return the bounding rect of the source.
std::string getApplicationName() const
return the application name, as specified by argv[0]
ossimRefPtr< ossimImageSource > addScalarRemapper(ossimRefPtr< ossimImageSource > &source, ossimScalarType scalar) const
Creates ossimScalarRemapper and connects to source.
ossimRefPtr< ossimMapProjection > getMapProjection()
Convenience method to get a pointer to the output map projection.
void addCommandLineOption(const ossimString &option, const ossimString &explanation)
virtual ossimObject * dup() const =0
bool hasGeoPolyCutterOption() const
bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Initializes record from an in-memory KWL and prefix.
void setAddResamplerCacheFlag(bool flag)
If flag is true a resampler cache will be added to the chain at create time.
void propagateOutputProjectionToChains()
loops through all chains and sets the output projection.
static const char * PROJECTION_KW
ossimFilename noExtension() const
void setAddNullPixelFlipFlag(bool flag)
If flag is true a null pixel flip will be added to the chain at create time.
This uses a derivative of Blinn's bump function to compute a 3-D looking image.
void getMetersPerPixel(ossimDpt &gsd)
Loops through all layers to get the best gsd.
static ossimString upcase(const ossimString &aString)
ossim_uint32 numberOf(const char *str) const
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
ossimScalarType getScalarTypeFromString(const ossimString &s) const
bool getIrect(const std::string &s, ossimIrect &rect) const
Gets rect from string in the form of <x>,<y>,<w>,<h>.
This is a 2 color view of the input.
static const char * OUTPUT_FILE_KW
ossim_float64 width() const
static const ossimFilename NIL
This was taken from Wx widgets for performing touch and access date stamps.
ossimRefPtr< ossimImageSource > initializeColorReliefChain()
Initializes a color relief chain.
virtual void disconnect(ossimConnectableObject *object=0)
Will disconnect the object passed in.
void getImageSpaceScale(ossimDpt &imageSpaceScale) const
Gets the image space scale.
static const char * CENTRAL_MERIDIAN_KW
ossimRefPtr< const ossimImageSharpenFilter > getSharpenFilter() const
bool setChainEntry(ossimRefPtr< ossimSingleImageChain > &chain, ossim_uint32 entryIndex) const
Sets entry for a chain.
virtual ~ossimChipperUtil()
virtual destructor
Represents serializable keyword/value map.
bool addFile(const char *file)
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
void setOptionsToChain(ossimIrect &aoi, const ossimKeywordlist &kwl)
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if not defined...
ossimRefPtr< const ossimImageHandler > getImageHandler() const
static const ossimErrorCode OSSIM_OK
ossim_uint8 toUInt8() const
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
ossimRefPtr< ossimSingleImageChain > createChain(const ossimFilename &file, ossim_uint32 entryIndex, bool isDemSource) const
Creates a ossimSingleImageChain from file.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=NULL) const
Will save the state of the chain.
void setSharpenFlag(bool flag)
Sets the sharpenflag.
const char * find(const char *key) const
virtual bool addListener(ossimListener *listener)
Overrides base "addListener" this will capture the pointer and then call the base class "addListener"...
ossimRefPtr< ossimImageSource > initializeBumpShadeChain()
Initializes a bump shade chain.
void addOptions(ossimArgumentParser &parser)
const ossimMapProjection * getAsMapProjection() const
ossimReferenced allows for shared object ref counting if the reference count ever gets to 0 or less i...
virtual ossimString getEntryString(ossim_int32 entry_number) const
bool read(const std::string &str)
search for an occurance of a string in the argument list, on sucess remove that occurance from the li...
std::ostream & print(std::ostream &out) const
Prints contents to output stream.
ossimFilename getHistogramFile() const
Returns the currently opened histogram.
double nan()
Method to return ieee floating point double precision NAN.
void addArguments(ossimArgumentParser &ap)
Adds application arguments to the argument parser.
ossimRefPtr< ossimImageFileWriter > m_writer
We need access to the writer so we can support aborting.
void getBoundingRect(ossimIrect &bounding_rect) const
Get the bounding rect of (0, 0) to (imageSize.x-1, imageSize.y-1).
bool computeHistogram(const ossimIrect &roi)
Compute the histogram from input connection and region of interest.
virtual void setOrigin(const ossimGpt &origin)
Sets theOrigin to origin.
void addDemSource(const ossimFilename &file, ossim_uint32 entryIndex)
Method to create a chain and add to dem layers from file.
ossimFilename getFilename() const
ossim_uint32 height() const
bool contains(char aChar) const
bool hasKey(const std::string &key) const
Checks for key in map.
static ossimImageWriterFactoryRegistry * instance()
void addList(const ossimKeywordlist &src, bool overwrite=true)
Visitor to update view and then propagate property event to outputs.
void createRenderedChain()
Create a rendered image chain.
static ossimString toString(bool aValue)
Numeric to string methods.
bool hasBumpShadeArg() const
virtual void setTileSize(const ossimIpt &tileSize)
Sets the output image tiling size if supported by the writer.
virtual bool isGeographic() const
ossimRefPtr< ossimImageSource > initializePsmChain()
Initializes a psm (pan sharpening multispectra) chain.
const ossimIpt & ul() const
void split(std::vector< ossimString > &result, const ossimString &separatorList, bool skipBlankFields=false) const
Splits this string into a vector of strings (fields) using the delimiter list specified.
virtual void setPointSize(const ossimIpt &size)
void addPair(const std::string &key, const std::string &value, bool overwrite=true)
ossim_float64 hgt
Height in meters above the ellipsiod.
virtual ossimString getClassName() const
virtual void setDecimalDegreesPerPixel(const ossimDpt &gsd)
ossim_uint32 toUInt32() const
virtual ossim_uint32 saveStateOfAllInputs(ossimKeywordlist &kwl, bool saveThisStateFlag=true, ossim_uint32 objectIndex=1, const char *prefix=0) const
Save the state of all inputs to a keyword list.
bool keyIsTrue(const std::string &key) const
void setCommandLineUsage(const ossimString &explanation)
void initializeProjectionGsd()
Initializes the projection gsd.
ossimDpt getDegreesPerPixel() const
Returns the resolution of this image in degrees/pixel.
ossimApplicationUsage * getApplicationUsage()
void getBandList(std::vector< ossim_uint32 > &bandList) const
Gets the band list if BANDS keyword is set.
virtual void setProperty(ossimRefPtr< ossimProperty > property)
This class imlements the fusion algorithm from the paper:
ossim_float64 getRotation() const
Gets rotation.
ossimRefPtr< ossimKeywordlist > m_srcKwl
Hold contents of src file if –src is used.
void setImageSize(const ossimIpt &size)
An image mosaic is a simple combiner that will just do a simple mosaic.
bool hasBrightnesContrastOperation() const
virtual bool write(const char *file, const char *comment=0) const
Methods to dump the ossimKeywordlist to a file on disk.
void setBandIndexMapping(ossim_uint32 oldInputBandIndex, ossim_uint32 newInputBandIndex, ossimTwoColorMultiViewOutputSource redOutputSource, ossimTwoColorMultiViewOutputSource grnOutputSource, ossimTwoColorMultiViewOutputSource bluOutputSource)
Sets which bands to use from inputs, and which inputs to use for output red, green and blue channels...
void setBrightnessContrastFlag(bool flag)
Sets the brightness contrast flag.
void initializeSrcKwl()
Initializes m_srcKwl if option was set.
virtual void initialize()
ossimRefPtr< ossimImageSource > addAnnotations(ossimRefPtr< ossimImageSource > &source) const
Add annotation source to chain.
void setDefaultBandSelection()
virtual void setUpperLeftPosition(const ossimIpt &position)
void setImageViewTransform(ossimImageViewTransform *transform)
void setBandSelection(const std::vector< ossim_uint32 > &bandList)
method to set band selector.
ossim_uint32 getNumberOfInputs() const
int numberOfParams(const std::string &str, const ossimParameter value) const
ossim_uint32 getNumberOfKeysThatMatch(const ossimString ®ularExpression) const
Gets number keys that match regular expression.
Single image chain class.
virtual void setMetersPerPixel(const ossimDpt &gsd)
std::vector< ossimRefPtr< ossimSingleImageChain > > m_imgLayer
Array of image source chains.
virtual void setElevationAngle(double angle)
ossimRefPtr< ossimMapProjection > getFirstInputProjection()
Gets the first input projection.
virtual bool addObject(ossimAnnotationObject *anObject)
ossimConnectableObject * getInput(ossim_uint32 index=0)
returns the object at the specified index.
ossim_int32 toInt32() const
ossim_int32 getZone() const
void clear()
Disconnects and clears the dem and image layers.
void reportRemainingOptionsAsUnrecognized(ossimErrorSeverity severity=OSSIM_BENIGN)
for each remaining option report it as an unrecongnized.
void setStretchMode(StretchMode mode, bool rebuildTableFlag=false)
Sets remap mode to mode.
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
void setCutType(ossimRectangleCutType cutType)
static const char * ZONE_KW
void createIdentityProjection()
Sets the single image chain for identity operations view to a ossimImageViewAffineTransform.
ossimChipperUtil()
default constructor
static ossimScalarTypeLut * instance()
Returns the static instance of an ossimScalarTypeLut object.
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
ossimRefPtr< ossimImageSource > createCombiner() const
ossim_float64 getBrightness() const
Gets the brightness level.
void getImageSpacePivot(ossimDpt &imageSpacePivot) const
Gets the image space pivot.
ossimString replaceAllThatMatch(const char *regularExpressionPattern, const char *value="") const
void setEntryIndex(ossim_int32 i)
void initializeOutputProjection()
Initializes the output projection and propagates to image chains.
bool errors(ossimErrorSeverity severity=OSSIM_BENIGN) const
virtual void setOutputScalarType(ossimScalarType scalarType)
Sets the output scalar type.
void setFilename(const ossimFilename &f)
bool addWmsBbox(const ossimString &wmsBbox)
OSSIM_DLL void toVector(std::vector< ossimDpt > &result, const ossimString &stringOfPoints)
Will take a string list separated by spaces and convert to a vector of ossimDpts. ...
void toPoint(const std::string &s)
Initializes this point from string.
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if non defined...
bool localToWorld(const ossimDpt &local_pt, ossimGpt &world_pt) const
Exposes the 3D projection from image to world coordinates.
virtual void setScale(const ossimDpt &scale)
void initializeIvtScale()
Initializes the image view transform(IVT) scale.
void setLine(const ossimDpt &start, const ossimDpt &end)
std::string::size_type size() const
ossimIpt midPoint() const
virtual void setString(const ossimString &s)
bool toBool() const
String to numeric methods.
std::string::iterator begin()
ossimRefPtr< ossimImageSource > combineLayers()
Combines dems(m_demLayer) and images(m_imgLayer).
void setLut(const ossimFilename &file)
Set lookup table(lut) method.
ossim_float64 getCentralMeridian() const
Gets value of key "central_meridan" if set, nan if not.
bool hasThumbnailResolution() const
unsigned int ossim_uint32
ossimDpt getMetersPerPixel() const
Returns the GSD associated with this image in the active projection.
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
void toPoint(const std::string &s)
Initializes this point from string.
void getRgbColorSource(ossim_uint8 &r, ossim_uint8 &g, ossim_uint8 &b) const
Gets the red, green and blue color source values.
bool setupChainHistogram(ossimRefPtr< ossimSingleImageChain > &chain, std::shared_ptr< ossimSrcRecord > srcRecordPtr=0) const
Set up ossimHistogramRemapper for a chain.
void setRgbColorSource(ossim_uint8 r, ossim_uint8 g, ossim_uint8 b)
Set the red, green and blue color source values.
ossim_float64 toFloat64() const
ossimChipperOutputProjection
emumerated output projections
void setTrackScaleFlag(bool flag)
virtual void setAzimuthAngle(double angle)
ossim_float64 getContrast() const
Gets the contrast level.
ossimRefPtr< ossimKeywordlist > m_kwl
Hold all options passed into intialize.
void setApplicationName(const ossimString &name)
void getTiePoint(ossimGpt &tie)
Loops through all layers to get the upper left tie point.
ossimChipperOutputProjection getOutputProjectionType() const
Gets the emumerated output projection type.
const ossimIpt & lr() const
static ossimString downcase(const ossimString &aString)
virtual ossimIrect getImageRectangle(ossim_uint32 resLevel=0) const
Returns zero-based bounding rectangle of the image.
ossimRefPtr< ossimMapProjection > getNewGeoProjection()
Convenience method to get geographic projection.
virtual ossim_int32 connectMyInputTo(ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
Will try to connect this objects input to the passed in object.
Class to draw fonts onto an image.
static const char * AZIMUTH_ANGLE_KW
ossim_uint32 width() const
static const char * BANDS_KW
void getAreaOfInterest(ossimImageSource *source, ossimIrect &rect) const
Initializes "rect" with the output area of interest.
void addImgSources()
Creates chains for all images.
ossimRefPtr< ossimImageGeometry > m_geom
The image geometry.
virtual void setEnableFlag(bool flag)
void toPoint(const std::string &s)
Initializes this point from string.
ossim_uint32 size() const
void intiailizeProjectionTiePoint()
Sets the projection tie point to the scene bounding rect corner.
ossimScalarType getOutputScalarType() const
Returns the scalar type from OUTPUT_RADIOMETRY_KW keyword if present.
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
void addCrossHairAnnotation(ossimRefPtr< ossimAnnotationSource > annotator, const std::string &prefix) const
Adds cross hair graphic to annotation source.
const ossimGpt & getOrigin() const
void setZone(const ossimGpt &ground)
static ossimProjectionFactoryRegistry * instance()
ossimRefPtr< const ossimHistogramRemapper > getHistogramRemapper() const
ossimRefPtr< ossimImageFileWriter > createNewWriter() const
Creates a new writer.
void setAddHistogramFlag(bool flag)
If flag is true a histogram will be added to the chain at create time.
ossimChipperOperation m_operation
Enumerated operation to perform.
std::string getHemisphere() const
bool hasScaleOption() const
bool isSrcFile(const ossimFilename &file) const
static const char * ORIGIN_LATITUDE_KW
static const char * ENTRY_KW
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
Will pass this call to the head of the list.
void applyScale(const ossimDpt &scale, bool recenterTiePoint)
Changes the GSD and image size to reflect the scale provided.
virtual void setFilename(const ossimFilename &file)
ossimRefPtr< ossimImageSource > m_source
We need to support changing clips without doing a full initilization.
void initializeThumbnailProjection(const ossimIrect &originalRect, ossimIrect &adjustedRect)
Method to calculate and initialize scale and area of interest for making a thumbnail.
void snapTiePointToOrigin()
bool hasWmsBboxCutWidthHeight() const
const ossimProjection * getProjection() const
Access methods for projection (may be NULL pointer).
ossimRefPtr< ossimImageViewAffineTransform > m_ivt
Image view transform(IVT).
virtual ossimImageSource * createImageSource(const ossimString &name) const
void getTiePoint(ossimGpt &tie, bool edge) const
Get the latitude, longitude of the tie point.
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
This class defines an abstract Handler which all image handlers(loaders) should derive from...
virtual void setProperty(ossimRefPtr< ossimProperty > property)
virtual ossimErrorCode getErrorStatus() const
bool hasBandSelection() const
ossimDpt midPoint() const
void getSortedList(std::vector< ossimString > &prefixValues, const ossimString &prefixKey) const
This return the sorted keys if you have a list.
void usage(ossimArgumentParser &ap)
Initializes arg parser and outputs usage.
void setDescription(const ossimString &desc)
void createOutputProjection()
Creates the output or view projection.
void addImgSource(const ossimFilename &file, ossim_uint32 entryIndex)
Method to create a chain and add to img layers from file.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
ossim_uint32 getEntryNumber() const
void setSmoothnessFactor(double value)
virtual void setAreaOfInterest(const ossimIrect &inputRect)
static const char * HEMISPHERE_KW
virtual void initialize()
void setRemapToEightBitFlag(bool flag)
Sets remap to eigth bit flag.
bool open(const ossimFilename &file, bool openOverview=true)
open method that takes an image file.
const ossimChipperUtil & operator=(const ossimChipperUtil &rhs)
Hidden from use assignment operator.
ossim_uint32 getSize() const
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
virtual void eastingNorthingToLineSample(const ossimDpt &eastingNorthing, ossimDpt &lineSample) const
void setReaderProps(ossimImageHandler *ih) const
Passes reader properties to single image handler if any.
bool hasCutBoxWidthHeight() const
ossimRefPtr< ossimImageSource > initialize2CmvChain()
Combines two images into a two color multi view chain.
static ossimInit * instance()
ossim_float64 upIsUpAngle(const ossimDpt &) const
ossim_float64 getOriginLatitude() const
Gets value of key "origin_latitude" if set, nan if not.
void initialize()
Initial method to be ran prior to execute.
ossimImageFileWriter * createWriter(const ossimFilename &filename) const
virtual void setUlTiePoints(const ossimGpt &gpt)
bool worldToLocal(const ossimGpt &world_pt, ossimDpt &local_pt) const
Exposes the 3D world-to-local image coordinate reverse projection.
bool isThreeBandOut() const
virtual void accept(ossimVisitor &visitor)
We will add a visitor interface for all connectable objects.
ossimRefPtr< ossimMapProjection > getNewGeoScaledProjection()
Convenience method to get geographic projection.
ossimRefPtr< ossimMapProjection > getNewProjectionFromSrsCode(const std::string &code)
Convenience method to get a projection from an srs code.
ossimRefPtr< const ossimImageRenderer > getImageRenderer() const
ossimRefPtr< ossimImageData > getChip(const ossimKeywordlist &optionsKwl=ossimKeywordlist())
Gets initialized area of interest(aoi) from chain.
virtual void initialize()=0
ossimString & gsub(const ossimString &searchKey, const ossimString &replacementValue, bool replaceAll=false)
Substitutes searchKey string with replacementValue and returns a reference to *this.
static const char * ELEVATION_ANGLE_KW
void setAreaOfInterest(const ossimIrect &rect)
ossimTwoColorMultiViewOutputSource
Enumerations for mapping inputs to red, green and blue output channels.
void getClipPolygon(ossimGeoPolygon &polygon) const
ossimFilename & setExtension(const ossimString &e)
Sets the extension of a file name.
bool hasHistogramOperation() const
virtual bool removeListener(ossimListener *listener)
Overrides base "removeListener".
virtual bool setCurrentEntry(ossim_uint32 entryIdx)
ossim_float64 northUpAngle() const
bool scaleToEightBit() const
void execute()
execute method.
void addDemSources()
Create chains for all dems.
ossimFilename getFilenameWithThisExtension(const ossimString &ext, bool set_e0_prefix=false) const
Returns the image file with extension set using supplentary directory for dirname if set...
int & argc()
return the argument count.
void setHemisphere(const ossimGpt &ground)
virtual std::ostream & print(std::ostream &out) const
Prints data members to stream.
void setExpandEnvVarsFlag(bool flag)
bool snapTieToOrigin() const
void setThreeBandFlag(bool flag)
Sets the three band flag.
bool padThumbnail() const
virtual void getBoundingRect(ossimDrect &rect) const
unsigned char ossim_uint8
static ossimImageSourceFactoryRegistry * instance()
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
bool openHistogram(const ossimFilename &histogram_file)
Open the histogram file.
ossimRefPtr< ossimMapProjection > getNewUtmProjection()
Convenience method to get a utm projection.
virtual bool execute()
Calls: writeFile() writeMetaDataFiles()
void addGeoPolyCutterPolygon(const vector< ossimGpt > &polygon)
bool isDemFile(const ossimFilename &file) const
ossimRefPtr< const ossimBrightnessContrastSource > getBrightnessContrast() const
void writeErrorMessages(std::ostream &output, ossimErrorSeverity sevrity=OSSIM_BENIGN)
write out error messages at an above specified .
const std::string & string() const
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)
void setAddChainCacheFlag(bool flag)
If flag is true a chain cache will be added to the chain at create time.
std::vector< ossimRefPtr< ossimSingleImageChain > > m_demLayer
Array of dem chains.
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
ossim_float64 min< ossim_float64 >(ossim_float64 a, ossim_float64 b)