HiRISE
 PDS_JP2

Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
PDS_Converter Class Referenceabstract

A PDS_Converter is used to convert an attached PDS image label to or from a detached PDS/JP2 label. More...

#include <PDS_Converter.hh>

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

Public Member Functions

 PDS_Converter ()
 Constructs an empty PDS_Converter. More...
 
 PDS_Converter (const std::string &pathname, const char **excluded_names=NULL, const char **image_names=NULL)
 Constructs a PDS_Converter from a named file. More...
 
 PDS_Converter (const PDS_Converter &converter)
 Copies a PDS_Converter. More...
 
virtual PDS_Converteroperator= (const PDS_Converter &converter)
 Assigns another PDS_Converter to this PDS_Converter. More...
 
virtual ~PDS_Converter ()
 Frees the PDS_Data::PDS_Data_Block_List and its contents. More...
 
virtual 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)=0
 Write a detached PDS/JP2 label file. More...
 
virtual 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)=0
 Write a PDS label file for image data to be appended. More...
 
virtual std::string product_names () const
 Get the name of the product types that this converter is intended to process. More...
 
virtual bool label_recognized () const =0
 Test whether the label parameters are recognized by this converter. More...
 
PDS_Converterlabel_size (unsigned int size)
 Set the preferred size of a label file. More...
 
unsigned int label_size () const
 Get the preferred size of a label file. More...
 
PDS_Data::PDS_Data_Block_Listdata_blocks () const
 Get the list of data blocks in the PDS label. More...
 
void refresh_data_blocks ()
 Refresh the list of data blocks. More...
 
Image_Data_Blockimage_data ()
 Get the Image_Data_Block from the PDS_Data::PDS_Data_Block_List. More...
 
PDS_Converterexcluded_data_block_names (const char **names)
 Set the names of parameters to be excluded from the data block list. More...
 
const char ** excluded_data_block_names () const
 Get the names of parameters to be excluded from the data block list. More...
 
PDS_Converterimage_data_block_names (const char **names)
 Set the parameter names of image data blocks. More...
 
const char ** image_data_block_names () const
 Get the parameter names of image data blocks. More...
 
idaeim::PVL::AggregatePDS_JP2_image_parameters (const std::string &JP2_pathname)
 Assemble PDS/JP2 image file description parameters. More...
 
unsigned int write_label (const std::string &pathname, PDS_Data &label, idaeim::PVL::Lister *lister=NULL, bool pad_label=false)
 Write a label file. More...
 
- Public Member Functions inherited from PDS_Data
 PDS_Data ()
 Construct PDS_Data with no parameters. More...
 
 PDS_Data (const idaeim::PVL::Aggregate &parameters)
 Construct PDS_Data from a PVL Parameter Aggregate. More...
 
 PDS_Data (const idaeim::PVL::Aggregate &parameters, const std::string &detached)
 Construct PDS_Data from a PVL Parameter Aggregate. More...
 
 PDS_Data (const std::string &pathname)
 Construct PDS_Data from a named file. More...
 
PDS_Data_Block_Listdata_blocks (const char **excluded=NULL, const char **image_block_names=NULL)
 Get a list of all binary data blocks in the PDS data. More...
 
idaeim::PVL::Parameterfind_parameter (const std::string &pathname, bool case_sensitive=false, int skip=0, Parameter_Class_Selection parameter_class=ANY_PARAMETER) const
 Find a named Parameter. More...
 
virtual PDS_Dataparameters (const std::string &pathname)
 Set the parameters from a source file. More...
 
virtual PDS_Dataparameters (const idaeim::PVL::Aggregate &parameters)
 Set the parameters from a Parameter Aggregate. More...
 
idaeim::PVL::Parameterremove_parameter (const std::string &pathname, bool case_sensitive=false, int skip=0, Parameter_Class_Selection parameter_class=ANY_PARAMETER)
 Removes a named Parameter. More...
 
template<typename T >
bool parameter_value (const std::string &pathname, T &value, bool case_sensitive=false, int skip=0)
 Set the value of a named parameter. More...
 
double numeric_value (const std::string &pathname, bool case_sensitive=false, int skip=0) const
 Get the numeric value of a named parameter. More...
 
std::string string_value (const std::string &pathname, bool case_sensitive=false, int skip=0) const
 Get the string value of a named parameter. More...
 
- Public Member Functions inherited from Aggregate
Aggregateadd (const Parameter &parameter)
 
Aggregateadd (Parameter *parameter)
 
 Aggregate (const Aggregate &aggregate)
 
 Aggregate (Parser &parser, const std::string name="")
 
 Aggregate (const std::string name="", const idaeim::PVL::Parameter::Type type_code=Default_Subtype)
 
 Aggregate (const Parameter &parameter)
 
Depth_Iterator begin_depth ()
 
Aggregateclone () const
 
int compare (const Parameter &parameter) const
 
Aggregatecopy_in (const Aggregate &aggregate)
 
Depth_Iterator end_depth ()
 
void entering (Parameter *parameter)
 
Parameterfind (const std::string &pathname, bool case_sensitive=false, int skip=0, idaeim::PVL::Parameter::Type type=(Type)(ASSIGNMENT|AGGREGATE)) const
 
bool is (const Type type) const
 
bool is_Aggregate () const
 
bool is_Group () const
 
bool is_Object () const
 
Aggregatemove_in (Aggregate &aggregate)
 
Aggregateoperator= (const Parameter &parameter)
 
Aggregateoperator= (const Aggregate &parameter)
 
Aggregateoperator= (const Assignment &parameter)
 
Aggregateoperator= (const Value &value)
 
const Parameteroperator[] (unsigned int index) const
 
Parameteroperator[] (unsigned int index)
 
void read (std::istream &in=std::cin)
 
void read (Parser &parser)
 
Parameterremove (size_type index)
 
Parameterremove (Parameter *parameter)
 
Parameterremove (iterator position)
 
Parameterremove_depth (Parameter *parameter)
 
void removing (Parameter *parameter)
 
size_type total_size ()
 
Aggregatetype (const int type)
 
Type type () const
 
std::string type_name () const
 
Valuevalue () const
 
 ~Aggregate ()
 
- Public Member Functions inherited from Parameter
bool at_pathname (std::string pathname, bool case_sensitive, const Parameter *root=NULL) const
 
bool at_pathname (std::string pathname) const
 
bool at_pathname (std::string pathname, bool case_sensitive, const Parameter &root) const
 
std::string comment () const
 
Parametercomment (const std::string &comment)
 
bool has_children () const
 
Parameterindenting (const MODE_STATE state, const WHICH_MODE which=LOCAL_MODE_SET)
 
Parameterindenting (const bool enable)
 
MODE_STATE indenting (const WHICH_MODE which=RECURSIVE_MODE_SET) const
 
virtual bool is_Assignment () const
 
virtual bool is_Token () const
 
Parametermode_state (const MODE mode, const MODE_STATE state, const WHICH_MODE which=LOCAL_MODE_SET)
 
const MODE_STATEmode_state (const WHICH_MODE which=LOCAL_MODE_SET) const
 
MODE_STATE mode_state (const MODE mode, const WHICH_MODE which=RECURSIVE_MODE_SET) const
 
Parametermode_state (const MODE_STATE *const modes, const WHICH_MODE which=LOCAL_MODE_SET)
 
std::string name () const
 
Parametername (const std::string &name)
 
bool operator!= (const Parameter &parameter) const
 
bool operator< (const Parameter &parameter) const
 
bool operator<= (const Parameter &parameter) const
 
bool operator== (const Parameter &parameter) const
 
bool operator> (const Parameter &parameter) const
 
bool operator>= (const Parameter &parameter) const
 
 Parameter (const Parameter &parameter)
 
 Parameter (const std::string &name="")
 
Aggregateparent () const
 
std::string pathname (const Parameter *root=NULL) const
 
std::string pathname (const Parameter &root) const
 
std::string pathname_to (const Parameter *root=NULL) const
 
std::string pathname_to (const Parameter &root) const
 
std::ostream & print (std::ostream &out=std::cout) const
 
Aggregateroot () const
 
MODE_STATE verbatim_strings (const WHICH_MODE which=RECURSIVE_MODE_SET) const
 
Parameterverbatim_strings (const bool enable)
 
Parameterverbatim_strings (const MODE_STATE state, const WHICH_MODE which=LOCAL_MODE_SET)
 
unsigned int write (std::ostream &out=std::cout, int depth=0) const
 
virtual ~Parameter ()
 
- Public Member Functions inherited from Vectal< Parameter >
void assign (size_type number, const_reference value)
 
void assign (Iterator start, Iterator stop)
 
reference at (size_type index)
 
const_reference at (size_type index) const
 
reference back ()
 
const_reference back () const
 
Iterator begin ()
 
Const_Iterator begin () const
 
void clear ()
 
Iterator end ()
 
Const_Iterator end () const
 
void erase (size_type index)
 
iterator erase (iterator start, iterator stop)
 
iterator erase (iterator position)
 
reference front ()
 
const_reference front () const
 
iterator insert (iterator position, const_reference value)
 
void insert (size_type index, const_reference value)
 
void insert (iterator position, size_type number, const_reference value)
 
void insert (iterator position, InputIterator start, InputIterator stop)
 
Vectaloperator= (const Vectal< value_type > &vectal)
 
const_reference operator[] (size_type index) const
 
reference operator[] (size_type index)
 
pointer peek (const iterator &position)
 
pointer peek (const const_iterator &position) const
 
pointer peek_back ()
 
pointer peek_back () const
 
iterator poke (iterator position, pointer value_pointer)
 
void poke (size_type index, pointer value_pointer)
 
iterator poke (iterator position, const_iterator start, const_iterator stop)
 
void poke_back (pointer value_pointer)
 
void pop_back ()
 
iterator pull (iterator position)
 
iterator pull (iterator start, iterator stop)
 
pointer pull_back ()
 
pointer pull_out (size_type index)
 
pointer pull_out (iterator position)
 
void push_back (const_reference value)
 
Reverse_Iterator rbegin ()
 
Const_Reverse_Iterator rbegin () const
 
Const_Reverse_Iterator rend () const
 
Reverse_Iterator rend ()
 
pointer replace (iterator position, pointer value_pointer)
 
void resize (size_type new_size)
 
void resize (size_type new_size, const_reference value)
 
 Vectal (Iterator start, Iterator stop)
 
 Vectal (const Vectal &vectal)
 
 Vectal ()
 
 Vectal (size_type size, const_reference value)
 
Basevector_base ()
 
void wipe ()
 
virtual ~Vectal ()
 

Static Public Attributes

static const char *const ID
 Class identification name with source code version and date. More...
 
static const char * DEFAULT_PRODUCT_TYPE = "unspecified"
 Default product name. More...
 
static const char * UNCOMPRESSED_FILE_PARAMETERS_GROUP = "UNCOMPRESSED_FILE"
 Name of the PDS/JP2 label parameter group describing the source uncompressed file. More...
 
static const char * COMPRESSED_FILE_PARAMETERS_GROUP = "COMPRESSED_FILE"
 Names of the PDS/JP2 label parameter group describing the destination compressed file. More...
 
static const char * GeoTIFF_PARAMETER_NAME = "GeoTIFF_Included"
 GeoTIFF included. More...
 
static const char * GML_PARAMETER_NAME = "GML_Included"
 GML included. More...
 
static const char * NO_VERSION_CHANGE_PARAMETER_NAME = "No_Version_Change"
 No Version number change. More...
 
- Static Public Attributes inherited from PDS_Data
static const char *const ID
 Class identification name with source code version and date. More...
 
static const char * PDS_ID_PARAMETER_NAME = "PDS_VERSION_ID"
 Name of the parameter providing the PDS ID. More...
 
static const char * RECORD_TYPE_PARAMETER_NAME = "RECORD_TYPE"
 Name of the parameter specifying the type of label records. More...
 
static const char * BYTE_RECORD_TYPE = "UNDEFINED"
 The record type used to define byte count based records. More...
 
static const char * FIXED_LENGTH_RECORD_TYPE = "FIXED_LENGTH"
 The record type used to define fixed length records. More...
 
static const char * LABEL_RECORDS_PARAMETER_NAME = "LABEL_RECORDS"
 Name of the parameter specifying the number of records in the label. More...
 
static const char * RECORD_BYTES_PARAMETER_NAME = "RECORD_BYTES"
 Name of the parameter specifying the number of bytes per record. More...
 
static const char * FILE_RECORDS_PARAMETER_NAME = "FILE_RECORDS"
 Name of the parameter specifying the number of records in the file. More...
 
static const char * INTERCHANGE_FORMAT_PARAMETER_NAME = "INTERCHANGE_FORMAT"
 Name of the parameter indicating the data format. More...
 
static const char * IMAGE_DATA_BLOCK_NAME = "IMAGE"
 Name of the Image_Data_Block parameter group. More...
 
static const char * BYTES_UNITS = "BYTES"
 Units name for storage measured in bytes. More...
 
static const char RECORD_POINTER_PARAMETER_MARKER = '^'
 Record pointer parameter prefix. More...
 
- Static Public Attributes inherited from Parameter
static const bool DEFAULT_CASE_SENSITIVITY
 
static const char DEFAULT_PATHNAME_DELIMITER
 
static const char *const ID
 
- Static Public Attributes inherited from Vectal_ID
static const char *const ID
 

Protected Member Functions

void clear_data_blocks ()
 Clear the data blocks list. More...
 
- Protected Member Functions inherited from Vectal< Parameter >
virtual void entering (pointer value_pointer)
 
virtual void removing (pointer value_pointer)
 

Protected Attributes

const char ** Excluded_Data_Block_Names
 Names (NULL-terminated array) of data blocks to be exluded from the list of data blocks (probably because they are redundant with other data blocks). More...
 
PDS_Data::PDS_Data_Block_ListData_Blocks
 Pointer to the list of data blocks found in the PDS label. More...
 
const char ** Image_Data_Block_Names
 Names (NULL-terminated array) of data blocks that are Image_Data_Blocks. More...
 
Image_Data_BlockIMAGE_Data_Block
 Pointer to the IMAGE data block in the Data_Blocks list. More...
 
unsigned int Label_Size
 The preferred size of the attached PDS label. More...
 
- Protected Attributes inherited from Parameter
std::string Comment
 
MODE_STATE Modes [TOTAL_LOCAL_MODES]
 
std::string Name
 
AggregateParent
 

Additional Inherited Members

- Public Types inherited from PDS_Data
enum  Parameter_Class_Selection {
  AGGREGATE_PARAMETER = -1 ,
  ANY_PARAMETER = 0 ,
  ASSIGNMENT_PARAMETER = 1
}
 Selects the class of parameter to find. More...
 
typedef std::vector< PDS_Data_Block * > PDS_Data_Block_List
 A vector of PDS_Data_Block object pointers. More...
 
- Public Types inherited from Aggregate
typedef Parameter_List::const_iterator const_iterator
 
typedef Depth_Iterator depth_iterator
 
typedef Parameter_List::iterator iterator
 
typedef Vectal< ParameterParameter_List
 
- Public Types inherited from Parameter
enum  MODE
 
enum  MODE_STATE
 
enum  Type
 
enum  WHICH_MODE
 
typedef Integer Default_Value
 
- Public Types inherited from Vectal< Parameter >
typedef Base::allocator_type allocator_type
 
typedef std::vector< Parameter * > Base
 
typedef Base::const_iterator Base_const_iterator
 
typedef Base::const_reverse_iterator Base_const_reverse_iterator
 
typedef Base::iterator Base_iterator
 
typedef Base::reverse_iterator Base_reverse_iterator
 
typedef Const_Iterator const_iterator
 
typedef const pointer const_pointer
 
typedef const value_typeconst_reference
 
typedef Const_Reverse_Iterator const_reverse_iterator
 
typedef const value_type const_value_type
 
typedef Base::difference_type difference_type
 
typedef Iterator iterator
 
typedef value_typepointer
 
typedef value_typereference
 
typedef Reverse_Iterator reverse_iterator
 
typedef Base::size_type size_type
 
typedef Parameter value_type
 
- Static Public Member Functions inherited from PDS_Data
static Image_Data_Blockimage_data (PDS_Data_Block_List *data_block_list)
 Get the Image_Data_Block from a PDS_Data::PDS_Data_Block_List. More...
 
- Static Public Member Functions inherited from Aggregate
static Type default_type ()
 
static Type default_type (const int type)
 
- Static Public Member Functions inherited from Parameter
static bool case_sensitive ()
 
static bool case_sensitive (bool enable)
 
static char path_delimiter (const char delimiter)
 
static char path_delimiter ()
 
static std::string type_name (const Type type)
 
- Public Attributes inherited from Aggregate
 CASE_INSENSITIVE
 
 CASE_SENSITIVE
 
- Public Attributes inherited from Parameter
 Verbatim_Strings
 
 Indenting
 
 TOTAL_LOCAL_MODES
 
 MODE_FALSE
 
 MODE_TRUE
 
 MODE_INHERITED
 
 ASSIGNMENT
 
 TOKEN
 
 AGGREGATE
 
 GROUP
 
 OBJECT
 
 END
 
 END_GROUP
 
 END_OBJECT
 
 LOCAL_MODE_SET
 
 DEFAULT_MODE_SET
 
 RECURSIVE_MODE_SET
 
- Static Protected Attributes inherited from Parameter
static bool Case_Sensitive
 
static MODE_STATE DEFAULT_MODES [TOTAL_LOCAL_MODES]
 
static char Path_Delimiter
 

Detailed Description

A PDS_Converter is used to convert an attached PDS image label to or from a detached PDS/JP2 label.

A PDS_Converter inherits from PDS_Data which contains the label to be converted.

This abstract class provides a base for product-specific label converter classes. Each implementation must provide the label_recognized, write_PDS_JP2_label and write_PDS_label methods.

Author
Bradford Castalia; UA/HiROC
Version
1.16
See also
PDS_Converter::label_recognized()
PDS_Converter::write_PDS_JP2_label(const std::string&, const std::string&, const char**, PDS_Data*)
PDS_Converter::write_PDS_label(const std::string&, const Rectangle*, unsigned int, const char**, PDS*)

Constructor & Destructor Documentation

◆ PDS_Converter() [1/3]

Constructs an empty PDS_Converter.

◆ PDS_Converter() [2/3]

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

Constructs a PDS_Converter from a named file.

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

Parameters
pathnameThe pathname string to a source file with a 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.
Exceptions
invalid_argumentIf the converter is not capable of converting the source file.

References PDS_Converter::Data_Blocks, PDS_Data::data_blocks(), PDS_Converter::Excluded_Data_Block_Names, PDS_Converter::image_data(), PDS_Converter::IMAGE_Data_Block, PDS_Converter::Image_Data_Block_Names, and Parameter::pathname().

◆ PDS_Converter() [3/3]

PDS_Converter ( const PDS_Converter converter)

Copies a PDS_Converter.

Parameters
converterThe PDS_Converter to be copied.

◆ ~PDS_Converter()

~PDS_Converter ( )
virtual

Frees the PDS_Data::PDS_Data_Block_List and its contents.

References PDS_Converter::clear_data_blocks().

Member Function Documentation

◆ operator=()

PDS_Converter & operator= ( const PDS_Converter converter)
virtual

Assigns another PDS_Converter to this PDS_Converter.

Parameters
converterThe PDS_Converter whose contents are to be assigned to this PDS_Converter.

References PDS_Data::image_data(), and Vectal< T >::push_back().

◆ write_PDS_JP2_label()

virtual 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 
)
pure virtual

Write a detached PDS/JP2 label file.

N.B.: This is a pure virtual method that must be provided by the implementing class.

This method converts the PDS label held by this PDS_Converter, which is expected to be from a file with an attached label, to its detached PDS/JP2 form and writes the results to a file at the specified pathname. Though the method is free to convert the source label in place, this is strongly discouraged; instead modifications should be made to a copy of the source label. For example:

Copy the source PDS label. PDS_Data PDS_label (*this); Modify the label. ... Write the label file. write_label (pathname, PDS_label);

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 to be used by the label converter. May be NULL.
additional_parametersA pointer to PDS_Data that contains additional parameters with product-specific label conversion information. May be NULL.
See also
write_label(const std::string&, PDS_Data&, idaeim::PVL::Lister*, bool)

Implemented in HiRISE_PDS_Converter, HiPrecision_PDS_Converter, and Generic_PDS_Converter.

Referenced by main().

◆ write_PDS_label()

virtual 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 
)
pure virtual

Write a PDS label file for image data to be appended.

N.B.: This is a pure virtual method that must be provided by the implementing class.

This method converts the the PDS label held by this PDS_Converter, which is expected to be from a detached PDS/JP2 label, to its attached PDS form and writes the results to a file at the specified pathname. Though the method is free to convert the source label in place, this is strongly discouraged; instead modifications should be made to a copy of the source label. For example:

Copy the source PDS label. PDS_Data PDS_label (*this); Modify the label. ... Write the label file. write_label (pathname, PDS_label);

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 selected. 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.
See also
write_label(const std::string&, PDS_Data&, idaeim::PVL::Lister*, bool)

Implemented in HiRISE_PDS_Converter, HiPrecision_PDS_Converter, and Generic_PDS_Converter.

Referenced by main().

◆ product_names()

string product_names ( ) const
virtual

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

There is no particular meaning to the string that is returned. Each PDS_Converter implementation may choose whatever name(s) it sees fit. Nevertheless, it is recommended that each space separated word in the returned string be chosen to name a recognizable product such as the value of a label parameter that is known to identify the type of product. For example, the value of the INSTRUMENT_ID parameter might be used.

Returns
A string used to identify the type of products recognized by this PDS_Converter. This will be the DEFAULT_PRODUCT_TYPE name if the PDS_Converter implementation does not provide this method.

Reimplemented in HiRISE_PDS_Converter, HiPrecision_PDS_Converter, and Generic_PDS_Converter.

References PDS_Converter::DEFAULT_PRODUCT_TYPE.

Referenced by main().

◆ label_recognized()

virtual bool label_recognized ( ) const
pure virtual

Test whether the label parameters are recognized by this converter.

N.B.: A false return value does not necessarily mean that this converter will be unable to process the label; only that the label does not describe a product type recognized by the converter.

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

Implemented in HiRISE_PDS_Converter, HiPrecision_PDS_Converter, and Generic_PDS_Converter.

◆ label_size() [1/2]

PDS_Converter& label_size ( unsigned int  size)
inline

Set the preferred size of a label file.

N.B.: The preferred label size is a hint; the actual size of the label may be larger, but will not be smaller. If the label will not fit in the preferred size the label size is increased the to minimum size required rounded up to the nearest 1K (1024) bytes.

Parameters
sizeThe preferred size, in characters, of a label file.
Returns
This PDS_Converter.
See also
write_label(const std::string&, PDS_Data&, idaeim::PVL::Lister*, bool)

References PDS_Converter::Label_Size.

Referenced by main().

◆ label_size() [2/2]

unsigned int label_size ( ) const
inline

◆ data_blocks()

PDS_Data::PDS_Data_Block_List* data_blocks ( ) const
inline

Get the list of data blocks in the PDS label.

Returns
A pointer to the current data block list. This will be NULL if no data blocks are currently identified identified in the label. N.B. The list may not be current if the label {parameters} have been changed or otherwise modified; a refresh_data_blocks() refresh} of the data blocks can be used in this case.

References PDS_Converter::Data_Blocks.

◆ refresh_data_blocks()

void refresh_data_blocks ( )

Refresh the list of data blocks.

Both the general data blocks list and the image data block pointer are refreshed from the current PDS label parameters. The previous data blocks are deleted.

References PDS_Converter::clear_data_blocks(), and PDS_Converter::image_data().

Referenced by PDS_Converter::excluded_data_block_names(), and PDS_Converter::image_data_block_names().

◆ image_data()

Image_Data_Block * image_data ( )

◆ excluded_data_block_names() [1/2]

PDS_Converter & excluded_data_block_names ( const char **  names)

Set the names of parameters to be excluded from the data block list.

The list of known data blocks is updated. N.B.: The current image data block names are used to refresh the data block list, so if they are to be set they should be set first.

Parameters
namesA NULL-terminated array of character strings. May be NULL if no data blocks are to be excluded.
Returns
This PDS_Converter.

References PDS_Converter::Excluded_Data_Block_Names, and PDS_Converter::refresh_data_blocks().

◆ excluded_data_block_names() [2/2]

const char** excluded_data_block_names ( ) const
inline

Get the names of parameters to be excluded from the data block list.

Returns
A NULL-terminated array of character strings. May be NULL if no data blocks are to be excluded.
See also
excluded_data_block_names(const char**)

References PDS_Converter::Excluded_Data_Block_Names.

Referenced by Generic_PDS_Converter::write_PDS_JP2_label().

◆ image_data_block_names() [1/2]

PDS_Converter & image_data_block_names ( const char **  names)

Set the parameter names of image data blocks.

N.B.: The PDS_Data::IMAGE_DATA_BLOCK_NAME is always implicitly included even if the image names array is NULL.

The label's image data block is located. At the same time the list of known data blocks is also refreshed.

Parameters
namesA NULL-terminated array of character strings. May be NULL if only the PDS_Data::IMAGE_DATA_BLOCK_NAME is to be used.
Returns
This PDS_Converter.

References PDS_Converter::Image_Data_Block_Names, and PDS_Converter::refresh_data_blocks().

◆ image_data_block_names() [2/2]

const char** image_data_block_names ( ) const
inline

Get the parameter names of image data blocks.

Returns
A NULL-terminated array of character strings. May be NULL if only the PDS_Data::IMAGE_DATA_BLOCK_NAME is to be used.
See also
image_data_block_names(const char**)

References PDS_Converter::Image_Data_Block_Names.

◆ PDS_JP2_image_parameters()

Aggregate * PDS_JP2_image_parameters ( const std::string &  JP2_pathname)

Assemble PDS/JP2 image file description parameters.

Two groups of parameters are generated: A COMPRESSED_FILE group that refers to an associated JP2 file, and an UNCOMPRESSED_FILE group that describes the source image data file used to generate the JP2 file. The UNCOMPRESSED_FILE group also includes the complete IMAGE parameters group. The source image data filename is found in the name of the Parameter Aggregate containing this PDS label representation. The {image data block} is used to obtain the image data definitions. Example: OBJECT = COMPRESSED_FILE FILE_NAME = "PSP_002068_2635_RED.JP2" RECORD_TYPE = UNDEFINED ENCODING_TYPE = "JP2" ENCODING_TYPE_VERSION_NAME = "ISO/IEC15444-1:2004" INTERCHANGE_FORMAT = BINARY UNCOMPRESSED_FILE_NAME = "PSP_002068_2635_RED.IMG" REQUIRED_STORAGE_BYTES = 68624340 ^DESCRIPTION = "JP2INFO.TXT" END_OBJECT = COMPRESSED_FILE OBJECT = UNCOMPRESSED_FILE FILE_NAME = "PSP_002068_2635_RED.IMG" RECORD_TYPE = FIXED_LENGTH RECORD_BYTES = 10860 <BYTES> FILE_RECORDS = 6319 ^IMAGE = "PSP_002068_2635_RED.IMG" OBJECT = IMAGE ... END_OBJECT = IMAGE END_OBJECT = UNCOMPRESSED_FILE

@param  JP2_pathname    The pathname to the associated JP2 file. Only
    the final filename portion is used.
@return A pointer to a Parameter Aggregate containing the
    COMPRESSED_FILE and UNCOMPRESSED_FILE Aggregates. <b>N.B.</b>:
    Because two parameter Aggregates are assembled they are enclosed
    in a container Aggregate that is not expected to be retained;
    only the Parameter Aggregates it carries are relevant.
@throws runtime_error   If an {@link image_data() image data block}
    can not be found in the source label.

References Parameter::Aggregate, Parameter::Assignment, PDS_Data::BYTE_RECORD_TYPE, PDS_Data::BYTES_UNITS, Parameter::comment(), PDS_Converter::COMPRESSED_FILE_PARAMETERS_GROUP, file_name(), PDS_Data::FILE_RECORDS_PARAMETER_NAME, PDS_Data::FIXED_LENGTH_RECORD_TYPE, PDS_Converter::ID, Image_Data_Block::image_bands(), PDS_Converter::image_data(), PDS_Converter::IMAGE_Data_Block, PDS_Data::IMAGE_DATA_BLOCK_NAME, Image_Data_Block::image_height(), Image_Data_Block::image_width(), PDS_Data::INTERCHANGE_FORMAT_PARAMETER_NAME, Parameter::name(), Image_Data_Block::pixel_bytes(), Vectal< T >::poke_back(), PDS_Data::RECORD_BYTES_PARAMETER_NAME, PDS_Data::RECORD_POINTER_PARAMETER_MARKER, PDS_Data::RECORD_TYPE_PARAMETER_NAME, Aggregate::type(), PDS_Converter::UNCOMPRESSED_FILE_PARAMETERS_GROUP, and Value::units().

Referenced by Generic_PDS_Converter::write_PDS_JP2_label().

◆ write_label()

unsigned int write_label ( const std::string &  pathname,
PDS_Data label,
idaeim::PVL::Lister lister = NULL,
bool  pad_label = false 
)

Write a label file.

If a file exists at the specified pathname it will be replaced with the new file.

If label padding is enabled (it is not by default) and the size of the label file after writing the label parameters is less than the preferred label size the file will be padded with space characters up to the preferred size.

Parameters
pathnameThe pathname to the label file.
labelA reference to the PDS_Data containing the label parameters.
listerThe idaeim::PVL::Lister that will apply formatting to the label parameters as they are written. May be null (the default) and a standard PDS style lister will be {provided}. pad_label If true label file padding will be applied to ensure the label size is at least the preferred size; if false no padding will be applied. The total number of characters written to the label file. std::ios::failure If the label file can not be opened for writing.

References PDS_Converter::ID, UA::HiRISE::label_lister(), PDS_Converter::label_size(), PDS_Converter::Label_Size, Parameter::name(), Parameter::pathname(), Lister::reset_total(), and Lister::total().

Referenced by Generic_PDS_Converter::write_PDS_JP2_label(), and Generic_PDS_Converter::write_PDS_label().

◆ clear_data_blocks()

void clear_data_blocks ( )
protected

Clear the data blocks list.

The current data blocks are deleted and the pointers set to NULL.

References PDS_Converter::Data_Blocks, and PDS_Converter::IMAGE_Data_Block.

Referenced by PDS_Converter::refresh_data_blocks(), and PDS_Converter::~PDS_Converter().

Member Data Documentation

◆ ID

const char *const ID
static
Initial value:
=
"UA::HiRISE::PDS_Converter (1.14 2012/01/24 03:08:13)"

Class identification name with source code version and date.

Referenced by PDS_Converter::PDS_JP2_image_parameters(), and PDS_Converter::write_label().

◆ DEFAULT_PRODUCT_TYPE

const char * DEFAULT_PRODUCT_TYPE = "unspecified"
static

Default product name.

See also
product_names() const

Referenced by PDS_Converter::product_names().

◆ UNCOMPRESSED_FILE_PARAMETERS_GROUP

const char * UNCOMPRESSED_FILE_PARAMETERS_GROUP = "UNCOMPRESSED_FILE"
static

Name of the PDS/JP2 label parameter group describing the source uncompressed file.

Referenced by PDS_Converter::PDS_JP2_image_parameters().

◆ COMPRESSED_FILE_PARAMETERS_GROUP

const char * COMPRESSED_FILE_PARAMETERS_GROUP = "COMPRESSED_FILE"
static

Names of the PDS/JP2 label parameter group describing the destination compressed file.

Referenced by PDS_Converter::PDS_JP2_image_parameters().

◆ GeoTIFF_PARAMETER_NAME

const char * GeoTIFF_PARAMETER_NAME = "GeoTIFF_Included"
static

◆ GML_PARAMETER_NAME

const char * GML_PARAMETER_NAME = "GML_Included"
static

◆ NO_VERSION_CHANGE_PARAMETER_NAME

const char * NO_VERSION_CHANGE_PARAMETER_NAME = "No_Version_Change"
static

◆ Excluded_Data_Block_Names

const char** Excluded_Data_Block_Names
protected

Names (NULL-terminated array) of data blocks to be exluded from the list of data blocks (probably because they are redundant with other data blocks).

Referenced by PDS_Converter::excluded_data_block_names(), PDS_Converter::image_data(), and PDS_Converter::PDS_Converter().

◆ Data_Blocks

PDS_Data::PDS_Data_Block_List* Data_Blocks
protected

◆ Image_Data_Block_Names

const char** Image_Data_Block_Names
protected

Names (NULL-terminated array) of data blocks that are Image_Data_Blocks.

Referenced by PDS_Converter::image_data(), PDS_Converter::image_data_block_names(), and PDS_Converter::PDS_Converter().

◆ IMAGE_Data_Block

Image_Data_Block* IMAGE_Data_Block
protected

◆ Label_Size

unsigned int Label_Size
protected

The preferred size of the attached PDS label.

Referenced by PDS_Converter::label_size(), PDS_Converter::write_label(), and Generic_PDS_Converter::write_PDS_label().


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