HiRISE
 PDS_JP2

Public Member Functions | Static Public Attributes

HiRISE_PDS_Converter Class Reference

A HiRISE_PDS_Converter is used to convert a HiRISE image data product PDS label between its attached PDS form and its detached PDS/JP2 form. More...

#include <HiRISE_PDS_Converter.hh>

Inheritance diagram for HiRISE_PDS_Converter:
Inheritance graph
[legend]
Collaboration diagram for HiRISE_PDS_Converter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 HiRISE_PDS_Converter ()
 Constructs an empty HiRISE_PDS_Converter.
 HiRISE_PDS_Converter (const std::string &pathname, const char **excluded_names=NULL, const char **image_names=NULL)
 Constructs a HiRISE_PDS_Converter from a named file.
bool label_recognized () const
 Test whether the label parameters are recognized by this converter.
void write_PDS_JP2_label (const std::string &PDS_label_pathname, const std::string &JP2_pathname, const char **removed_parameter_names=NULL, PDS_Data *additional_parameters=NULL)
 Write a detached PDS/JP2 label file.
void write_PDS_label (const std::string &PDS_label_pathname, const Rectangle *image_region=NULL, unsigned int resolution_level=1, const char **removed_parameter_names=NULL, PDS_Data *additional_parameters=NULL)
 Write a PDS label for image data to be appended.
std::string product_names () const
 Get the name of the product types that this converter is intended to process.
void data_set_version (PDS_Data *additional_parameters)
 Adjust the data set version parameters.
void adjust_image_map_projection (idaeim::PVL::Aggregate *image_map_projection, const Rectangle &image_region, unsigned int ratio)
 Adjust the IMAGE_MAP_PROJECTION_GROUP_NAME of parameters.

Static Public Attributes

static const char *const ID = "UA::HiRISE::HiRISE_PDS_Converter (1.21 2015/01/09 19:42:28)"
 Class identification name with source code version and date.
static const char * PRODUCT_TYPE_PARAMETER_NAME = "INSTRUMENT_ID"
 Name of the parameter whose value is the product name being converted.
static const char * HIRISE_PRODUCT_TYPE = "HIRISE"
 Default product name if the PRODUCT_TYPE_PARAMETER_NAME is not found.
static const char * EXCLUDED_DATA_BLOCK_NAMES []
 Names of data blocks to be ignored (redundant with other data blocks).
static const char * IMAGE_DATA_BLOCK_NAMES []
 Names of additional Image_Data_Block parameter aggregates.
static const int DEFAULT_PDS_LABEL_SIZE = 32768
 Default size (bytes) of an attached PDS label.
static const char * UPDATE_VERSION_PARAMETER_NAMES []
static const int DATA_SET_VERSION_MINOR_VALUE = 1
 DATA_SET_xxx version minor value.
static const char * IMAGE_MAP_PROJECTION_GROUP_NAME = "IMAGE_MAP_PROJECTION"
 IMAGE_MAP_PROJECTION parameters to be adjusted.
static const char * PROJECTION_TYPE_PARAMETER_NAME = "MAP_PROJECTION_TYPE"
 Projection type.
static const char * HORIZONATAL_OFFSET_PARAMETER_NAME = "SAMPLE_PROJECTION_OFFSET"
 Horizonatal offset.
static const char * VERTICAL_OFFSET_PARAMETER_NAME = "LINE_PROJECTION_OFFSET"
 Vertical offset.
static const char * IMAGE_HEIGHT_PARAMETER_NAME = "LINE_LAST_PIXEL"
 Image height.
static const char * IMAGE_WDITH_PARAMETER_NAME = "SAMPLE_LAST_PIXEL"
 Image width.
static const char * PIXELS_PER_DEGREE_PARAMETER_NAME = "MAP_RESOLUTION"
 Pixels per degree.
static const char * METERS_PER_PIXEL_PARAMETER_NAME = "MAP_SCALE"
 Meters per pixel.
static const char * MINIMUM_LATITUDE_PARAMETER_NAME = "MINIMUM_LATITUDE"
 Minimum latitude.
static const char * MAXIMUM_LATITUDE_PARAMETER_NAME = "MAXIMUM_LATITUDE"
 Maximum latitude.
static const char * EASTERN_LONGITUDE_PARAMETER_NAME = "EASTERNMOST_LONGITUDE"
 Eastern longitude.
static const char * WESTERN_LONGITUDE_PARAMETER_NAME = "WESTERNMOST_LONGITUDE"
 Western longitude.

Detailed Description

A HiRISE_PDS_Converter is used to convert a HiRISE image data product PDS label between its attached PDS form and its detached PDS/JP2 form.

This class provides the HiRISE product-specific implementation of a PDS_Converter.

Author:
Bradford Castalia, UA/HiROC
Version:
1.20
See also:
PDS_Converter

Constructor & Destructor Documentation

Constructs an empty HiRISE_PDS_Converter.

HiRISE_PDS_Converter ( const std::string &  pathname,
const char **  excluded_names = NULL,
const char **  image_names = NULL 
) [explicit]

Constructs a HiRISE_PDS_Converter from a named file.

The PDS file may contain an attached PDS label or be a detached PDS/JP2 label file. Either the write_PDS_label or write_PDS_JP2_label methods can be used to convert either source, respectively.

Parameters:
pathnameThe pathname to the source file containing the PDS label.
excluded_namesThe NULL-terminated array of character strings naming data blocks to be excluded from conversion consideration. May be NULL.
image_namesThe NULL-terminated array of character strings naming data blocks that describe image data. N.B.: The PDS_Data::IMAGE_DATA_BLOCK_NAME is always implicitly included. May be NULL.

Member Function Documentation

bool label_recognized (  ) const [virtual]

Test whether the label parameters are recognized by this converter.

The test will succeed if an image data block can be found in the source file label and a PRODUCT_TYPE_PARAMETER_NAME is found with the HIRISE_PRODUCT_TYPE value.

Returns:
true if the label parameters are recognized by this converter; false otherwise.

Reimplemented from Generic_PDS_Converter.

References PDS_Data::find_parameter(), and Parameter::value().

void write_PDS_JP2_label ( const std::string &  PDS_label_pathname,
const std::string &  JP2_pathname,
const char **  removed_parameter_names = NULL,
PDS_Data additional_parameters = NULL 
) [virtual]

Write a detached PDS/JP2 label file.

A copy is made of the source label represented by the Parameter Aggregate of the PDS_Converter base class. The original parameters are then have data set version updates applied if appropriate.

Then the base class write_PDS_JP2_label method is called to apply the generic label modifications and write the label file. Finally the copy of the original parameters is restored to the content of this converter.

Parameters:
PDS_label_pathnameThe pathname for the detached label file.
JP2_pathnameThe name of the JP2 image data file referened by the label file.
removed_parameter_namesA NULL terminated array of character strings that are the names of parameters to be removed from the source label before being written. May be NULL.
additional_parametersA pointer to PDS_Data that contains additional parameters with product-specific label conversion information. May be NULL.
Exceptions:
ios::failureIf the label file could no be created.
See also:
Generic_PDS_Converter::write_PDS_JP2_label(const std::string&, const std::string&, const char**, PDS_Data*)

Reimplemented from Generic_PDS_Converter.

void write_PDS_label ( const std::string &  PDS_label_pathname,
const Rectangle image_region = NULL,
unsigned int  resolution_level = 1,
const char **  removed_parameter_names = NULL,
PDS_Data additional_parameters = NULL 
) [virtual]

Write a PDS label for image data to be appended.

A copy is made of the source label represented by the Parameter Aggregate of the PDS_Converter base class. The original parameters then have their image map projection parameters adjusted to be consistent with the selected image region and rendering resolution.

Then the base class write_PDS_label method is called to apply the generic label modifications and write the label file. Finally the copy of the original parameters is restored to the content of this converter.

Parameters:
PDS_label_pathnameThe pathname for the file that begins with the converted PDS label.
image_regionA Rectangle pointer that specifies a region within the image that was rendered. N.B.: The rendered image region is specifed after any resolution change has been applied (don't just shift the full resolution image region by the resolution level, which may be inaccurate, get the rendered image size from the JP2 decoder). If NULL, the entire image was selected.
resolution_levelThe resolution level at which the image is rendereed from the JP2 codestream is rendered. 1 is full resolution, 2 is half resolution, 3 is quarter resolution, etc.; i.e. the rendering scale is 1 / (2**(L - 1)).
removed_parameter_namesA NULL terminated array of character strings that are the names of parameters to be removed from the source label before being written. May be NULL.
additional_parametersA pointer to PDS_Data that contains additional parameters with product-specific label conversion information. May be NULL.
Exceptions:
runtime_errorIf the source label does not contain the expected parameters required to achieve the conversion.
ios::failureIf the label file could no be created.
See also:
adjust_image_map_projection(idaeim::PVL::Aggregate*, const Rectangle&, unsigned int)
Generic_PDS_Converter::write_PDS_label(const std::string&, const Rectangle*, unsigned int, const char**, PDS_Data*)

Reimplemented from Generic_PDS_Converter.

References UA::HiRISE::find_parameter().

string product_names (  ) const [virtual]

Get the name of the product types that this converter is intended to process.

The value of the INSTRUMENT_ID parameter is used.

Returns:
A string used to identify the type of products recognized by this PDS_Converter.

Reimplemented from Generic_PDS_Converter.

References PDS_Data::find_parameter(), and Parameter::value().

void data_set_version ( PDS_Data additional_parameters )

Adjust the data set version parameters.

Unless the additional_parameters are non-null and contain a GeoTIFF_PARAMETER_NAME or GML_PARAMETER_NAME parameter with a value of "TRUE" or "1", nothing is done.

For each of the UPDATE_VERSION_PARAMETER_NAMES the parameter value has its minor version number set to the DATA_SET_VERSION_MINOR_VALUE if it is less than that value. The version number is expected to be at the end of the parameter value string in the format "Vm.n", where m is the major version number and n is the minor version number. If any of the UPDATE_VERSION_PARAMETER_NAMES can not be found or a minor version number is not found in its value, it is left unchanged.

Parameters:
additional_parametersA pointer to PDS_Data that contains additional parameters with product-specific label conversion information. May be NULL.

References UA::HiRISE::find_parameter(), Parameter::name(), UA::HiRISE::string_value(), UA::HiRISE::to_uppercase(), and Parameter::value().

void adjust_image_map_projection ( idaeim::PVL::Aggregate image_map_projection,
const Rectangle image_region,
unsigned int  ratio 
)

Adjust the IMAGE_MAP_PROJECTION_GROUP_NAME of parameters.

This method is only used during the write_PDS_label PDS/JP2 to PDS label conversion.

N.B.: The parameters are modified in place.

The following parameters are adjusted to be consistent with a selected subarea and/or reduced resolution rendering of the image:

Image size

The size, in pixels, of the image. The values of these parameters will be set to the image region width and height and are expected to be identical to the size of the rendered image listed in the IMAGE parameters group.

Projection offsets

Key values used to map image locations (sample,line) to to real world (longitude,latitude) locations. The values of these parameters are relative to the image origin (upper-left corner).

Image resolution

Defines the size of a pixel in real world units which are specified by the parameter. The values of these parameters are adjusted by the rendering ratio.

Image boundaries
Specifies the real world (longitude and latitude degrees) location of the image edges. The values of these parameters are re-mapped to the boundaries of the image region.

N.B.: If the IMAGE_MAP_PROJECTION_GROUP_NAME parameter value specifies that a stereographicp projection was used and the image region is not the entire image then the image boundary parameters will be removed from the converted label because the linear re-mapping normally used would not be reliable for the non-linear projection. An implementation of the non-linear projection algorithm is needed to correct this defect. These parameters are not necessary to perform mappings between image (sample, line) and real world (longitude,latitude) locations using the appropriate projection algorithm.

Parameters:
image_map_projectionA pointer to the Parameter Aggregate that contains the IMAGE_MAP_PROJECTION parameters.
image_regionThe Rectangle of image data that will be rendered relative to the scaled image pixel grid. The size of the rectangle is the size of the output image to be described. The origin of the rectangle is the position of the upper-left corner of the output image on the scaled image grid.
ratioThe ratio of full resolution image grid to the the scaled image grid. The ratio will always be a power of 2 corresponding to the selected image rendering resolution level. A ratio of 1 means the image was not scaled, 2 means the size of the scaled resolution grid is half the size of the full resolution image grid, 4 when the grid is quarter scale, etc.

References Size_2D::Height, Image_Data_Block::image_height(), Image_Data_Block::image_width(), Aggregate::remove(), Parameter::value(), Size_2D::Width, Point_2D::X, and Point_2D::Y.


Member Data Documentation

const char *const ID = "UA::HiRISE::HiRISE_PDS_Converter (1.21 2015/01/09 19:42:28)" [static]

Class identification name with source code version and date.

Reimplemented from Generic_PDS_Converter.

const char * PRODUCT_TYPE_PARAMETER_NAME = "INSTRUMENT_ID" [static]

Name of the parameter whose value is the product name being converted.

See also:
product_names() const
const char * HIRISE_PRODUCT_TYPE = "HIRISE" [static]

Default product name if the PRODUCT_TYPE_PARAMETER_NAME is not found.

See also:
product_names() const
const char * EXCLUDED_DATA_BLOCK_NAMES [static]
Initial value:
        {
        "CALIBRATION_LINE_PREFIX_TABLE",
        "CALIBRATION_LINE_SUFFIX_TABLE",
        "LINE_PREFIX_TABLE",
        "LINE_SUFFIX_TABLE",
        0
        }

Names of data blocks to be ignored (redundant with other data blocks).

const char * IMAGE_DATA_BLOCK_NAMES [static]
Initial value:
        {
        "CALIBRATION_IMAGE",
        0
        }

Names of additional Image_Data_Block parameter aggregates.

const int DEFAULT_PDS_LABEL_SIZE = 32768 [static]

Default size (bytes) of an attached PDS label.

Reimplemented from Generic_PDS_Converter.

const char * UPDATE_VERSION_PARAMETER_NAMES [static]
Initial value:
        {
        "DATA_SET_ID",
        "DATA_SET_NAME",
        NULL
        }
const int DATA_SET_VERSION_MINOR_VALUE = 1 [static]

DATA_SET_xxx version minor value.

const char * IMAGE_MAP_PROJECTION_GROUP_NAME = "IMAGE_MAP_PROJECTION" [static]

IMAGE_MAP_PROJECTION parameters to be adjusted.

const char * PROJECTION_TYPE_PARAMETER_NAME = "MAP_PROJECTION_TYPE" [static]

Projection type.

const char * HORIZONATAL_OFFSET_PARAMETER_NAME = "SAMPLE_PROJECTION_OFFSET" [static]

Horizonatal offset.

const char * VERTICAL_OFFSET_PARAMETER_NAME = "LINE_PROJECTION_OFFSET" [static]

Vertical offset.

const char * IMAGE_HEIGHT_PARAMETER_NAME = "LINE_LAST_PIXEL" [static]

Image height.

const char * IMAGE_WDITH_PARAMETER_NAME = "SAMPLE_LAST_PIXEL" [static]

Image width.

const char * PIXELS_PER_DEGREE_PARAMETER_NAME = "MAP_RESOLUTION" [static]

Pixels per degree.

const char * METERS_PER_PIXEL_PARAMETER_NAME = "MAP_SCALE" [static]

Meters per pixel.

const char * MINIMUM_LATITUDE_PARAMETER_NAME = "MINIMUM_LATITUDE" [static]

Minimum latitude.

const char * MAXIMUM_LATITUDE_PARAMETER_NAME = "MAXIMUM_LATITUDE" [static]

Maximum latitude.

const char * EASTERN_LONGITUDE_PARAMETER_NAME = "EASTERNMOST_LONGITUDE" [static]

Eastern longitude.

const char * WESTERN_LONGITUDE_PARAMETER_NAME = "WESTERNMOST_LONGITUDE" [static]

Western longitude.


The documentation for this class was generated from the following files: