HiRISE
 Observation

Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
Image_Line Class Reference

An Image_Line contains a cache of observation channel image pixel data. More...

#include <Image_Line.hh>

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

Public Types

enum  Elements {
  Sync ,
  Channel ,
  Line_Number ,
  Buffer_Pixels ,
  Image_Pixels ,
  Black_Pixels ,
  Virtual_Pixels ,
  Total_Elements
}
 An Element refers to a data containing constituent of a component. More...
 
enum  Sync_Type {
  No_Sync_Type ,
  Line_Header_Sync_Type ,
  FELICS_Sync_Type
}
 Possible types of sync patterns. More...
 
- Public Types inherited from Data_Block
enum  Data_Order
 
enum  Array_Index_Counts
 
enum  Array_Offset_Counts
 
typedef unsigned int Index
 
typedef std::vector< IndexValue_List
 
typedef void(* Copier) (unsigned char *destination, int destination_amount, const unsigned char *source, int source_amount)
 

Public Member Functions

 Image_Line ()
 Constructs a default Image_Line. More...
 
 Image_Line (unsigned int bytes_per_pixel, unsigned int total_pixels, unsigned int total_lines=0, unsigned int channel_number=CCD_UNKNOWN, std::istream *stream=NULL)
 Constructs an Image_Line of a specified line length and pixel size. More...
 
 Image_Line (const Image_Line &component, bool duplicate=true)
 Copy constructor. More...
 
Image_Lineoperator= (const Image_Line &component)
 Assigns another Image_Line to this one. More...
 
virtual ~Image_Line ()
 Destructor. More...
 
std::string id () const
 Provides the class ID on a line followed by the base Data_Component::id. More...
 
const char * name () const
 Gets the NAME of this class. More...
 
u_int_32 sync () const
 Gets the extended Sync Element value. More...
 
Image_Linesync (u_int_32 value)
 Sets the extended Sync Element value. More...
 
u_int_32 channel () const
 Gets the Channel Element channel number. More...
 
Image_Linechannel (u_int_32 channel_number)
 Sets the Channel Element channel number. More...
 
u_int_32 expected_channel () const
 Gets the expected channel number for the line header. More...
 
Image_Lineexpected_channel (u_int_32 channel_number)
 Sets the expected channel number for the line header. More...
 
u_int_32 line_number () const
 Gets the Line_Number Element value. More...
 
Image_Lineline_number (u_int_32 line)
 Sets the Line_Number Element value. More...
 
bool bad_line () const
 Tests if the bad line flag is set. More...
 
Image_Linebad_line (bool state)
 Sets or clears the bad line flag. More...
 
std::string bad_line_description () const
 Gets the description of the bad line cause. More...
 
Pixel_type pixel (Index index) const
 Gets a pixel value. More...
 
Pixel_type operator[] (Index index) const
 Gets a pixel value. More...
 
void pixel (Index index, Pixel_type value)
 Sets a pixel value. More...
 
Pixel_type buffer_pixel (Index index) const
 Gets a Buffer_Pixels Element value. More...
 
void buffer_pixel (Index index, Pixel_type value)
 Sets a Buffer_Pixels Element value. More...
 
Pixel_type image_pixel (Index index) const
 Gets an Image_Pixels Element value. More...
 
void image_pixel (Index index, Pixel_type value)
 Sets an Image_Pixels Element value. More...
 
Pixel_type black_pixel (Index index) const
 Gets a Black_Pixels Element value. More...
 
void black_pixel (Index index, Pixel_type value)
 Sets a Black_Pixels Element value. More...
 
Pixel_type virtual_pixel (Index index) const
 Gets a Virtual_Pixels Element value. More...
 
void virtual_pixel (Index index, Pixel_type value)
 Sets a Virtual_Pixels Element value. More...
 
unsigned int pixel_count () const
 Gets the total number of pixels in the line. More...
 
Image_Linepixel_count (unsigned int total_pixels)
 Sets the total number of pixels in the line. More...
 
unsigned int pixel_bytes () const
 Gets the number of bytes per pixel. More...
 
Image_Linepixel_bytes (unsigned int bytes_per_pixel)
 Sets the number of bytes per pixel. More...
 
unsigned int total_lines () const
 Gets the total number of image lines in the channel data set. More...
 
Image_Linetotal_lines (unsigned int lines)
 Sets the total number of image lines in the channel data set. More...
 
void mirror ()
 Mirrors the order of all pixels. More...
 
Image_Linelookup (const LUT &lut)
 Applies a LUT mapping to all pixel values. More...
 
Image_Linepukool (Pixel_type *table)
 Applies a "reverse" table mapping to all pixel values. More...
 
std::istream & source () const
 Gets the istream being used as the source of line data. More...
 
Image_Linesource (std::istream &stream)
 Sets the input stream to be used as the source of line data. More...
 
bool next ()
 Gets the next image line. More...
 
unsigned int count () const
 Gets the current line count. More...
 
unsigned long long bytes_read () const
 Gets the number of bytes read from the data source. More...
 
unsigned long long source_bytes () const
 Gets the amount (bytes) of source data that has been used. More...
 
bool compressed_data () const
 Indicates if the source line data was FELICS compressed. More...
 
unsigned long long compressed_bytes () const
 Gets the amount (bytes) of compressed data that has been processed. More...
 
unsigned long long decompressed_bytes () const
 Gets the amount (bytes) of decompressed data that has been generated. More...
 
Line_Cachecache ()
 Gets the line's data management cache object. More...
 
bool synchronization_lost ()
 Check for lost line synchronization. More...
 
std::ostream & print (std::ostream &stream=std::cout, bool verbose=false) const
 Prints the component structure and contents. More...
 
unsigned int width () const
 Gets the print listing width. More...
 
Image_Linewidth (unsigned int groups)
 Sets the print listing width. More...
 
idaeim::PVL::AggregatePVL () const
 Produces a PVL rendition of the component. More...
 
idaeim::PVL::AggregatePVL_description () const
 Produces a PVL description of the observation image data layout for a PDS label. More...
 
bool is_valid () const
 Tests if the component data is valid. More...
 
- Public Member Functions inherited from Data_Component
 Data_Component (const char **names=NULL, unsigned int size=0, const Index *offsets=NULL, const Index indexed_arrays[][2]=NULL, Data_Order order=Data_Block::MSB)
 Constructs a Data_Component using component specifications. More...
 
 Data_Component (const Data_Component &component, bool data_duplicate=true)
 Copy constructor. More...
 
Data_Componentoperator= (const Data_Component &component)
 Assignment operator. More...
 
virtual ~Data_Component ()
 Destructor. More...
 
const char * name (Index element) const
 Gets the name of a component Element. More...
 
virtual u_int_32 get (Index element, Index index=0) const
 Gets a value from a data Element or array entry of the component. More...
 
virtual Data_Componentput (const u_int_32 value, Index element, Index index=0)
 Puts a value into a data Element or array entry of the component. More...
 
std::ostream & print_element (const Index element, int format=DECIMAL, std::ostream &stream=std::cout, int width=0) const
 Prints an Element description. More...
 
std::ostream & print_element (const Index element, std::ostream &stream) const
 Prints an Element description. More...
 
std::ostream & print_element_location (const Index element, std::ostream &stream=std::cout) const
 Prints the location of an Element in the component. More...
 
unsigned int element_location_print_width (Index element) const
 Gets the width of the Element location printing fields. More...
 
unsigned int name_field_width () const
 Gets the width of the Element name printing field. More...
 
Data_Componentname_field_width (unsigned int width)
 Sets the width of the Element name field for printing. More...
 
Data_Blockdata (void *const block)
 Overrides the base Data_Block::data to reset Local_Data. More...
 
Data_Blockattach (void *const block, unsigned int size)
 Attaches a new block of data to the component. More...
 
Data_Componentresize (unsigned int size)
 Resizes the block of local data storage. More...
 
unsigned char * data () const
 Gets a pointer to the current component storage. More...
 
unsigned int local_data ()
 Gets the size of the local data storage area. More...
 
u_int_16 internet_checksum () const
 Calculates the Internet Checksum as per RFC 1071. More...
 
- Public Member Functions inherited from Data_Block
 Data_Block ()
 
 Data_Block (void *const data, const Index *offsets, Index total_elements=0, const Index *array_counts=NULL, bool native_order=true)
 
 Data_Block (void *const data, const Value_List &offsets, const Value_List &array_counts, bool native_order=true)
 
 Data_Block (void *const data, const Value_List &offsets, bool native_order=true)
 
 Data_Block (void *const data, const Index *offsets, Index total_elements, const Index *array_counts, Data_Order data_order)
 
 Data_Block (void *const data, const Value_List &offsets, const Value_List &array_counts, Data_Order data_order)
 
 Data_Block (void *const data, const Index *offsets, Index total_elements, Data_Order data_order)
 
 Data_Block (void *const data, const Index *offsets, Data_Order data_order)
 
 Data_Block (void *const data, const Value_List &offsets, Data_Order data_order)
 
 Data_Block (void *const data, const Index *offsets, const Index indexed_counts[][2], Data_Order data_order)
 
 Data_Block (const Data_Block &data_block)
 
Data_Blockoperator= (const Data_Block &data_block)
 
virtual ~Data_Block ()
 
bool native () const
 
Data_Blocknative (bool native_order)
 
Data_Order data_order () const
 
Data_Blockdata_order (Data_Order order)
 
unsigned char * data () const
 
Index size () const
 
Value_List element_offsets_list () const
 
Indexelement_offsets ()
 
bool element_offsets (const Value_List &offsets)
 
bool element_offsets (const Index *offsets, Index total_elements=NO_INDEX)
 
bool element_sizes (const Value_List &sizes)
 
bool element_sizes (const Index *sizes, Index total_elements=NO_INDEX)
 
Index offset_of (Index element) const
 
bool offset_of (Index element, Index offset)
 
bool insert_element (Index offset, Index size, Index array_count=1)
 
Data_Blockdelete_element (Index element)
 
Data_Blockshift_offsets (int amount)
 
Index elements () const
 
Index size_of (Index element) const
 
bool size_of (Index element, Index size)
 
Index value_size_of (Index element) const
 
Data_Blockvalue_size_of (Index element, Index size)
 
Index index_of (Index offset) const
 
Value_List array_counts_list () const
 
Indexarray_counts ()
 
Data_Blockarray_counts (const Value_List &counts, Index begin=0)
 
Data_Blockarray_counts (const Index *counts, Index begin=0, Index end=NO_INDEX)
 
Data_Blockarray_indexed_counts (const Index indexed_counts[][2], Index total_counts=NO_INDEX)
 
Data_Blockarray_offset_counts (const Index offset_counts[][2], Index total_counts=NO_INDEX)
 
Index count_of (Index element) const
 
Data_Blockcount_of (Index element, Index count)
 
bool reset_counts (bool unconditional=true, Index begin=0, Index end=NO_INDEX)
 
const Data_Blockget (T &value, const Index element, const Index index=0) const
 
const Data_Blockget (T &value, const Index element, const Index index=0) const
 
get (const Index element, const Index index=0) const
 
get (const Index element, const Index index=0) const
 
Data_Blockput (T &value, const Index element, const Index index=0)
 
Data_Blockput (T &value, const Index element, const Index index=0)
 
const Data_Blockget (T *array, const Index element, Index count=0) const
 
const Data_Blockget (T *array, const Index element, Index count=0) const
 
Data_Blockput (T *array, const Index element, Index count=0)
 
Data_Blockput (T *array, const Index element, Index count=0)
 
std::istream & input (std::istream &stream)
 
std::ostream & output (std::ostream &stream) const
 
std::ostream & print (std::ostream &stream=std::cout) const
 

Static Public Member Functions

static unsigned int calibration_lines ()
 Gets the number of image lines designated as calibration data. More...
 
static void calibration_lines (unsigned int lines)
 Sets the number of image lines designated as calibration data. More...
 
static bool is_sync (void *data_at)
 Tests if some data contains a line header sync pattern. More...
 
static Sync_Type next_sync (std::istream &stream)
 Searches an istream for an image data synchronization pattern. More...
 
- Static Public Member Functions inherited from Instrument
static unsigned int calibration_lines_minimum (unsigned int TDI, unsigned int binning)
 
static int focal_plane_x_offset (unsigned int CPMM, unsigned int binning=1)
 
- Static Public Member Functions inherited from Data_Block
static Data_Order native_order ()
 
static Value_Listsizes_to_offsets (Value_List &sizes)
 
static Indexsizes_to_offsets (Index *sizes, Index total_elements=NO_INDEX)
 
static Value_Listoffsets_to_sizes (Value_List &offsets)
 
static Indexoffsets_to_sizes (Index *offsets, Index total_elements=NO_INDEX)
 

Static Public Attributes

static const char *const ID
 Class identification name with source code version and date. More...
 
static const char *const NAME = "Image Line"
 The component name. More...
 
static const char * NAMES []
 The name of each Element. More...
 
static const unsigned int LINE_HEADER_BYTES = 6
 The number of bytes in the line header section. More...
 
static const unsigned int BUFFER_PIXELS_COUNT = 12
 The number of buffer pixels. More...
 
static const unsigned int BLACK_PIXELS_COUNT = 16
 The number of black pixels. More...
 
static const unsigned int MAX_VIRTUAL_PIXELS_COUNT = MAX_VIRTUAL_PIXELS
 The maximum number of allowable virtual pixels. More...
 
static const unsigned int MAX_PIXELS_PER_LINE
 The maximum number of pixels allowed. More...
 
static const unsigned int DEFAULT_CALIBRATION_LINES = CALIBRATION_LINES
 The default number of calibration lines at the beginning of the observation channel data. More...
 
static const Index MAX_COMPONENT_BYTES
 Total maximum number of bytes in the Data_Block. More...
 
static const Index OFFSETS_TEMPLATE []
 Data_Block data storage address offset template for each Element. More...
 
static const Index ARRAY_COUNTS_TEMPLATE [][2]
 Data_Block array element value counts each keyed to an Element Index. More...
 
static const u_int_32 SYNC = 0xFF00E000
 Expected Sync Element value after extension. More...
 
static const u_int_8 SYNC_3 = 0xFF
 Expected Sync Element MSB (byte 3) value. More...
 
static const u_int_8 SYNC_2 = 0x00
 Expected Sync Element MSB+1 (byte 2) value. More...
 
static const u_int_8 SYNC_1_BIT_MASK = 0xE0
 Bit mask for the Sync Element extension field of the Channel Element. More...
 
static const u_int_8 CHANNEL_BIT_MASK = 0x1F
 Bit mask for channel number field of the Channel Element. More...
 
static const u_int_32 LINE_NUMBER_MASK = 0x007FFFFF
 Bit mask for the line number field of the Line_Number Element. More...
 
static const char * Sync_Type_Names []
 Sync_Type names. More...
 
static const unsigned int DEFAULT_WIDTH = LINE_PRINT_GROUPS_WIDTH
 The default width, in pixel groups, of a print listing. More...
 
static unsigned int Calibration_Lines = CALIBRATION_LINES
 Number of image lines at the beginning of the image data to be designated as calibration data. More...
 
- Static Public Attributes inherited from Data_Component
static const char *const ID
 Class identification name with source code version and date. More...
 
static const int DECIMAL = 0
 Format specifier. More...
 
static const int HEX = -1
 
static const int BOOLEAN = -2
 
static const char PATHNAME_DELIMITER = FILESYSTEM_PATHNAME_DELIMITER
 Host filesystem pathname delimiter. More...
 
static const int UTC_SECONDS_PRECISION = SECONDS_PRECISION
 UTC seconds precision (digits after the decimal point). More...
 
static const char SUBSECONDS_DELIMITER = ':'
 Delimits subseconds from seconds in clock count representations. More...
 
static const char *const SPICE_METAKERNEL_VARIABLE
 The name of the environment variable for the SPICE metakernel pathname. More...
 
static const char *const DEFAULT_SPICE_METAKERNEL
 The default SPICE metakernal pathname. More...
 
static const int MRO_CLOCK_ID = MRO_CLOCK_NAIF_ID
 The ID used by NAIF for specifying the MRO clock to CSPICE routines. More...
 
static const char *const INVALID_UTC_TIME = DEFAULT_INVALID_UTC_TIME
 
- Static Public Attributes inherited from Instrument
static const char *const ID
 
static const unsigned int CCDS
 
static const unsigned int CCD_UNKNOWN
 
static const char *const CCD_NAMES []
 
static const char *const CCD_FILTER_NAMES []
 
static const unsigned int CCD_BY_CPMM []
 
static const unsigned int CPMM_BY_CCD []
 
static const char *const WAVELENGTH_UNITS
 
static const unsigned int CCD_CENTER_WAVELENGTHS []
 
static const unsigned int CCD_BANDWIDTHS []
 
static const double CCD_FOCAL_PLANE_X_OFFSETS_MM []
 
static const double CCD_FOCAL_PLANE_Y_OFFSETS_MM []
 
static const double CCD_PIXEL_SIZE_MM
 
static const unsigned int CCD_CHANNELS
 
static const unsigned int CCD_CHANNEL_UNKNOWN
 
static const unsigned int CCD_IMAGE_SENSORS
 
static const unsigned int MAX_BYTES_PER_PIXEL
 
static const unsigned int MAX_PIXEL_VALUES []
 
static const unsigned int MAX_IMAGE_LINES
 
static const unsigned int TOTAL_TDI_STAGES
 
static const unsigned int TDI_STAGES []
 
static const unsigned int TOTAL_BINNING_FACTORS
 
static const unsigned int BINNING_FACTORS []
 
static const unsigned int CCD_BINNED_PIXELS []
 
static const unsigned int STORED_LUTS
 
static const unsigned int STIMULATOR_LEDS
 
static const char *const STIMULATOR_LED_NAMES []
 
static const double EXPOSURE_SETUP_MICROS
 
static const unsigned int DELTA_LINE_TIME_MAX
 
static const double DELTA_LINE_TIME_TICK_NANOS
 
static const double LINE_TIME_PRE_OFFSET
 
static const unsigned int TRIM_ADDITION_LINES
 
static const unsigned int REVERSE_READOUT_LINES
 
static const unsigned int MASKED_LINES
 
static const unsigned int DLL_LOCKED
 
static const unsigned int DLL_NOT_LOCKED
 
static const unsigned int SPACECRAFT_EPOCH
 
static const double MRO_CLOCK_SUBTICK_MICROS
 
static const double HIRISE_CLOCK_SUBTICK_MICROS
 
static const int SPACECRAFT_NAIF_ID
 
static const unsigned int SSR_BYTE_BOUNDARY
 
static const int UNKNOWN_NUMBER
 
static const int NOT_APPLICABLE_NUMBER
 
static const char *const UNKNOWN_STRING
 
static const char *const NOT_APPLICABLE_STRING
 
- Static Public Attributes inherited from Data_Block
static const char *const ID
 
static const Index NO_INDEX
 

Protected Attributes

unsigned int Pixels_per_Line
 Total pixels in a line. More...
 
unsigned int Bytes_per_Pixel
 Bytes per pixel. More...
 
unsigned int Total_Lines
 Total number of lines expected. More...
 
unsigned int Channel_Number
 Expected channel number. More...
 
Line_CacheData_Cache
 Line data cache. More...
 
unsigned int Width
 Width of listing (pixel groups). More...
 

Additional Inherited Members

- Public Attributes inherited from Data_Block
 MSB
 
 LSB
 
 ELEMENT_INDEX
 
 INDEX_COUNT
 
 ELEMENT_OFFSET
 
 OFFSET_COUNT
 
Copier Get
 
Copier Put
 
- Protected Member Functions inherited from Data_Block
void limits_checker (const Index element, const Index index, bool getter, bool array) const
 
- Static Protected Member Functions inherited from Data_Block
static void get_forwards (unsigned char *host, int host_amount, const unsigned char *data, int data_amount)
 
static void get_backwards (unsigned char *host, int host_amount, const unsigned char *data, int data_amount)
 
static void put_forwards (unsigned char *data, int data_amount, const unsigned char *host, int host_amount)
 
static void put_backwards (unsigned char *data, int data_amount, const unsigned char *host, int host_amount)
 

Detailed Description

An Image_Line contains a cache of observation channel image pixel data.

This Data_Component is the last in the observation channel data stream. The component contains a cache of image line data that was read or written. Methods are provided to advance sequentially through the image data lines available from a source data stream by reading data into the cache as needed. Unlike the other components of a HiRISE observation, an Image_Line does not have a fixed size, so its structure is dynamically sized when it is constructed or characteristics of its structure that affect its size are altered. The number of bytes per pixel and the number of pixels per line are the critical size determining characteristics. So while the component data layout always has the same relative relationships, these relationships are relative to these critical characteristics.

For details consult the "HiRISE Command and Telemetry Handbook" (http://hirise.lpl.arizona.edu/team_site/instrument/Command_and_Telemetry_Handbook/).

Header data block layout:

    Offset  Size  Description
    ------  ----  -----------
         0     2  Sync pattern (0xFF00)
         2     1  Channel number
                    Bits   Description
                    -----  -----------
                    0 - 4  Channel number
                    5 - 7  Sync pattern extension (0xE0)
         3     3  Line number
                    Bit 23 is the bad line flag (1 == bad line) 
         6  12*S  Buffer pixels
       IPO   L*S  Image pixels
       BPO  16*S  Black pixels
       VPO   V*S  Virtual pixels

The first 6 bytes contain the line header data.

S is the size of pixel in bytes. This will be either 1 or 2.

IPO is the image pixels offset: the line header size (6) plus the number of buffer pixel bytes (12*S).

L is the length, in pixels, of an image line (only those pixels exposed to the observation scene). This will be a maximum of 1024.

BPO is the black pixels offset: the line header size (6), plus the number of buffer pixels bytes (12*S), plus the number of image pixel bytes (L*S).

VPO is the virtual pixels offset: the line header size (6), plus the number of buffer pixels bytes (12*S), plus the number of image pixel bytes (L*S), plus the number of black pixel bytes (16*S).

V is the number of virtual pixels. Virtual pixels should only occur in special test data files produced by the instrument manufacturer; normally this is 0.

N.B.: Data_Block values are MSB ordered.

Author
Bradford Castalia, UA/PIRL, 12/03 1.37

Member Enumeration Documentation

◆ Elements

enum Elements

An Element refers to a data containing constituent of a component.

Each named Element is an Index into various data sets that define the attributes of a component; including their NAMES, data storage address OFFSETS_TEMPLATE, and number of array element values. It is the key Index argument of the data access methods.

See also
Data_Block
Enumerator
Sync 
Channel 
Line_Number 
Buffer_Pixels 
Image_Pixels 
Black_Pixels 
Virtual_Pixels 
Total_Elements 

◆ Sync_Type

enum Sync_Type

Possible types of sync patterns.

The types of sync patterns that can be identified when searching a file.

See also
next_sync(std::istream&)
Enumerator
No_Sync_Type 
Line_Header_Sync_Type 
FELICS_Sync_Type 

Constructor & Destructor Documentation

◆ Image_Line() [1/3]

Constructs a default Image_Line.

The OFFSETS_TEMPLATE and ARRAY_COUNTS_TEMPLATE are used to define the component structure. The line header Sync element is initialized to the SYNC value; all other elements are initialized to 0.

References Image_Line::SYNC, and Image_Line::sync().

◆ Image_Line() [2/3]

Image_Line ( unsigned int  bytes_per_pixel,
unsigned int  total_pixels,
unsigned int  total_lines = 0,
unsigned int  channel_number = CCD_UNKNOWN,
std::istream *  stream = NULL 
)

Constructs an Image_Line of a specified line length and pixel size.

The line header Sync element is initialized to the SYNC value; all other elements are initialized to 0.

Parameters
bytes_per_pixelThe number of bytes per pixel.
total_pixelsThe total number of image pixels. This includes buffer and dark pixels (and any virtual pixels).
total_linesThe total number of image lines in the channel data set; includes both calibration and exposed image lines.
channel_numberThe expected channel number for the lines.
streamThe istream from which to obtain the line data.
Exceptions
length_errorIf total_pixels is outside the allowable range of (BUFFER_PIXELS_COUNT + BLACK_PIXELS_COUNT) to MAX_PIXELS_PER_LINE.
out_of_rangeIf bytes_per_pixel is outside the allowable range of 1 to MAX_BYTES_PER_PIXEL.
See also
pixel_count(unsigned int)
pixel_bytes(unsigned int)

References Image_Line::pixel_bytes(), Image_Line::pixel_count(), Image_Line::SYNC, and Image_Line::sync().

◆ Image_Line() [3/3]

Image_Line ( const Image_Line component,
bool  duplicate = true 
)

Copy constructor.

The new Image_Line has no data source.

Parameters
componentThe Image_Line to be copied.
duplicatetrue if the data content of the copied component is to be duplicated in the copy; false if the data content is to be shared.
See also
Data_Component(const Data_Component&, bool)

◆ ~Image_Line()

~Image_Line ( )
virtual

Destructor.

If the data block memory for the component has been substituted with a locally managed cache, the cache is deleted.

References Image_Line::Data_Cache.

Member Function Documentation

◆ operator=()

Image_Line & operator= ( const Image_Line component)

Assigns another Image_Line to this one.

The structure and data content of the source line are copied, but nothing else; the number of total_lines, expected channel number, and data source related information are unchanged.

Parameters
componentThe Image_Line to be assigned.
See also
Data_Component::operator=(const Data_Component&)

References Data_Component::operator=().

◆ id()

string id ( ) const
virtual

Provides the class ID on a line followed by the base Data_Component::id.

Returns
The multi-line identification string.
See also
Data_Component::id()

Reimplemented from Data_Component.

References Data_Component::id(), and Image_Line::ID.

◆ name()

const char * name ( ) const
virtual

Gets the NAME of this class.

Returns
A pointer to the constant class name C-string.
See also
Data_Component::name()

Implements Data_Component.

References Image_Line::NAME.

◆ sync() [1/2]

u_int_32 sync ( ) const

Gets the extended Sync Element value.

The Sync Element contains the 2 most significant bytes of a 32-bit value. The least significant byte has a value of 0. The remaining byte (1) is the upper SYNC_1_BIT_MASK bits of the Channel Element value with the remaining lower bits set to 0.

Returns
A 32-bit extended Sync value.

References Image_Line::Channel, Data_Component::get(), Image_Line::Sync, and Image_Line::SYNC_1_BIT_MASK.

Referenced by Image_Line::channel(), Image_Line::Image_Line(), Image_Line::is_valid(), Line_Cache::next_line(), Image_Line::print(), and Image_Line::PVL().

◆ sync() [2/2]

Image_Line & sync ( u_int_32  value)

Sets the extended Sync Element value.

The 2 most significant bytes of the value put in the Sync Element. The next SYNC_1_BIT_MASK bits of the value are put in the Channel Element; the remainder of the Channel Element is left unchanged.

Parameters
valueThe extended Sync Element value.
Returns
This Image_Line.

References Image_Line::Channel, Image_Line::channel(), Data_Component::put(), Image_Line::Sync, and Image_Line::SYNC_1_BIT_MASK.

◆ channel() [1/2]

u_int_32 channel ( ) const

Gets the Channel Element channel number.

Only the CHANNEL_BIT_MASK bits of the Channel Element value are used; the other bits are cleared in the return value.

Returns
The channel number from the Channel Element.

References Image_Line::Channel, Image_Line::CHANNEL_BIT_MASK, and Data_Component::get().

Referenced by Line_Cache::next_line(), Image_Line::print(), Image_Line::PVL(), and Image_Line::sync().

◆ channel() [2/2]

Image_Line & channel ( u_int_32  channel_number)

Sets the Channel Element channel number.

Only the CHANNEL_BIT_MASK bits of the Channel Element value are changed; the other bits are unaffected.

Parameters
channel_numberThe value to put in the Channel Element.
Returns
This Image_Line.

References Image_Line::Channel, Image_Line::CHANNEL_BIT_MASK, Data_Component::get(), Data_Component::put(), and Image_Line::sync().

◆ expected_channel() [1/2]

u_int_32 expected_channel ( ) const
inline

Gets the expected channel number for the line header.

For a valid line the expected channel number will match the channel number from the line header.

Returns
The expected channel number.

References Image_Line::Channel_Number.

Referenced by Line_Cache::reset(), and Observation::reset_line().

◆ expected_channel() [2/2]

Image_Line& expected_channel ( u_int_32  channel_number)
inline

Sets the expected channel number for the line header.

For a valid line the expected channel number will match the channel number from the line header.

Parameters
channel_numberThe expected channel number.
Returns
This Image_Line.
See also
channel()

References Image_Line::Channel_Number.

◆ line_number() [1/2]

u_int_32 line_number ( ) const

Gets the Line_Number Element value.

Returns
The Line_Number Element value.

References Data_Component::get(), Image_Line::Line_Number, and Image_Line::LINE_NUMBER_MASK.

Referenced by Image_Line::bad_line(), Line_Cache::next_line(), Image_Line::print(), and Image_Line::PVL().

◆ line_number() [2/2]

Image_Line & line_number ( u_int_32  line)

Sets the Line_Number Element value.

Parameters
lineThe line number to put in the Line_Number Element.
Returns
This Image_Line.

References Image_Line::Line_Number, Image_Line::LINE_NUMBER_MASK, and Data_Component::put().

◆ bad_line() [1/2]

bool bad_line ( ) const

Tests if the bad line flag is set.

Returns
true if the flag is set; false otherwise.

References Data_Component::get(), Image_Line::Line_Number, and Image_Line::LINE_NUMBER_MASK.

Referenced by main(), Line_Cache::next_line(), Image_Line::print(), and Image_Line::PVL().

◆ bad_line() [2/2]

Image_Line & bad_line ( bool  state)

Sets or clears the bad line flag.

Parameters
stateIf true, the flag is set; otherwise the flag is cleared.
Returns
This Image_Line.

References Image_Line::Line_Number, Image_Line::line_number(), Image_Line::LINE_NUMBER_MASK, and Data_Component::put().

◆ bad_line_description()

std::string bad_line_description ( ) const

Gets the description of the bad line cause.

Returns
The bad line cause description string. This will be empty if the line is not marked as bad. Otherwise a multi-line description
  • with each line, including the last, ending with a new-line - is returned.
See also
bad_line()

References Line_Cache::bad_line_description(), and Image_Line::Data_Cache.

Referenced by main().

◆ pixel() [1/2]

Pixel_type pixel ( Index  index) const

Gets a pixel value.

All pixel Elements are treated as a single line: Pixel 0 is the first of the Buffer_Pixels; pixel BUFFER_PIXELS_COUNT is the first of the Image_Pixels; pixel BUFFER_PIXELS_COUNT + count_of (Image_Pixels) is the first of the Black_Pixels.

Parameters
indexThe Index of the pixel in the line.
Returns
A generic Pixel_type value that is correct regardless of the number of pixel_bytes.
Exceptions
out_of_rangeIf the index is greater than or equal to the pixel_count.

References Image_Line::ID, Image_Line::operator[](), and Image_Line::Pixels_per_Line.

Referenced by Image_Line::lookup(), main(), Image_Line::print(), Image_Line::pukool(), and Image_Line::PVL().

◆ operator[]()

Pixel_type operator[] ( Index  index) const

Gets a pixel value.

All pixel Elements are treated as a single line.

Warning: No range checking is applied.

Returns
A generic Pixel_type value that is correct regardless of the number of pixel_bytes.

Referenced by Image_Line::black_pixel(), Image_Line::buffer_pixel(), Image_Line::image_pixel(), Image_Line::pixel(), and Image_Line::virtual_pixel().

◆ pixel() [2/2]

void pixel ( Index  index,
Pixel_type  value 
)

Sets a pixel value.

All pixel Elements are treated as a single line.

Parameters
indexThe Index of the pixel in the line.
valueA generic Pixel_type value. The corrent number of pixel_bytes will be put in the data block.
Exceptions
out_of_rangeIf the index is greater than or equal to the pixel_count.
invalid_argumentIf the value is greater than the MAX_PIXEL_VALUES for the number of pixel_bytes.
See also
pixel(Index) const

References Image_Line::Buffer_Pixels, Image_Line::Bytes_per_Pixel, Image_Line::ID, Instrument::MAX_PIXEL_VALUES, Image_Line::Pixels_per_Line, and Data_Component::put().

◆ buffer_pixel() [1/2]

Pixel_type buffer_pixel ( Index  index) const

Gets a Buffer_Pixels Element value.

Parameters
indexThe Index of the pixel in the Buffer_Pixels Element array portion of the line.
Returns
A generic Pixel_type value that is correct regardless of the number of pixel_bytes.
Exceptions
out_of_rangeIf the index is greater than or equal to the BUFFER_PIXELS_COUNT.

References Image_Line::BUFFER_PIXELS_COUNT, Image_Line::ID, and Image_Line::operator[]().

◆ buffer_pixel() [2/2]

void buffer_pixel ( Index  index,
Pixel_type  value 
)

Sets a Buffer_Pixels Element value.

Parameters
indexThe Index of the pixel in the Buffer_Pixels Element array portion of the line.
valueA generic Pixel_type value. The corrent number of pixel_bytes will be put in the data block.
Exceptions
out_of_rangeIf the index is greater than or equal to the BUFFER_PIXELS_COUNT.
invalid_argumentIf the value is greater than the MAX_PIXEL_VALUES for the number of pixel_bytes.

References Image_Line::Buffer_Pixels, Image_Line::BUFFER_PIXELS_COUNT, Image_Line::Bytes_per_Pixel, Image_Line::ID, Instrument::MAX_PIXEL_VALUES, and Data_Component::put().

◆ image_pixel() [1/2]

Pixel_type image_pixel ( Index  index) const

Gets an Image_Pixels Element value.

Parameters
indexThe Index of the pixel in the Image_Pixels Element array portion of the line.
Returns
A generic Pixel_type value that is correct regardless of the number of pixel_bytes.
Exceptions
out_of_rangeIf the index is greater than or equal to the count_of (Image_Pixels).

References Image_Line::BUFFER_PIXELS_COUNT, Data_Block::count_of(), Image_Line::ID, Image_Line::Image_Pixels, and Image_Line::operator[]().

◆ image_pixel() [2/2]

void image_pixel ( Index  index,
Pixel_type  value 
)

Sets an Image_Pixels Element value.

Parameters
indexThe Index of the pixel in the Image_Pixels Element array portion of the line.
valueA generic Pixel_type value. The corrent number of pixel_bytes will be put in the data block.
Exceptions
out_of_rangeIf the index is greater than or equal to the count_of (Image_Pixels).
invalid_argumentIf the value is greater than the MAX_PIXEL_VALUES for the number of pixel_bytes.

References Image_Line::Buffer_Pixels, Image_Line::BUFFER_PIXELS_COUNT, Image_Line::Bytes_per_Pixel, Data_Block::count_of(), Image_Line::ID, Image_Line::Image_Pixels, Instrument::MAX_PIXEL_VALUES, and Data_Component::put().

◆ black_pixel() [1/2]

Pixel_type black_pixel ( Index  index) const

Gets a Black_Pixels Element value.

Parameters
indexThe Index of the pixel in the Black_Pixels Element array portion of the line.
Returns
A generic Pixel_type value that is correct regardless of the number of pixel_bytes.
Exceptions
out_of_rangeIf the index is greater than or equal to the BLACK_PIXELS_COUNT.

References Image_Line::BLACK_PIXELS_COUNT, Image_Line::BUFFER_PIXELS_COUNT, Data_Block::count_of(), Image_Line::ID, Image_Line::Image_Pixels, and Image_Line::operator[]().

◆ black_pixel() [2/2]

void black_pixel ( Index  index,
Pixel_type  value 
)

Sets a Black_Pixels Element value.

Parameters
indexThe Index of the pixel in the Black_Pixels Element array portion of the line.
valueA generic Pixel_type value. The corrent number of pixel_bytes will be put in the data block.
Exceptions
out_of_rangeIf the index is greater than or equal to the BLACK_PIXELS_COUNT.
invalid_argumentIf the value is greater than the MAX_PIXEL_VALUES for the number of pixel_bytes.

References Image_Line::BLACK_PIXELS_COUNT, Image_Line::Buffer_Pixels, Image_Line::BUFFER_PIXELS_COUNT, Image_Line::Bytes_per_Pixel, Data_Block::count_of(), Image_Line::ID, Image_Line::Image_Pixels, Instrument::MAX_PIXEL_VALUES, and Data_Component::put().

◆ virtual_pixel() [1/2]

Pixel_type virtual_pixel ( Index  index) const

Gets a Virtual_Pixels Element value.

Parameters
indexThe Index of the pixel in the Virtual_Pixels Element array portion of the line.
Returns
A generic Pixel_type value that is correct regardless of the number of pixel_bytes.
Exceptions
out_of_rangeIf the index is greater than or equal to the BUFFER_PIXELS_COUNT.

References Image_Line::BLACK_PIXELS_COUNT, Image_Line::BUFFER_PIXELS_COUNT, Data_Block::count_of(), Image_Line::ID, Image_Line::Image_Pixels, Image_Line::operator[](), and Image_Line::Virtual_Pixels.

◆ virtual_pixel() [2/2]

void virtual_pixel ( Index  index,
Pixel_type  value 
)

Sets a Virtual_Pixels Element value.

Parameters
indexThe Index of the pixel in the Buffer_Pixels Element array portion of the line.
valueA generic Pixel_type value. The corrent number of pixel_bytes will be put in the data block.
Exceptions
out_of_rangeIf the index is greater than or equal to the count_of (Virtual_Pixels).
invalid_argumentIf the value is greater than the MAX_PIXEL_VALUES for the number of pixel_bytes.

References Image_Line::BLACK_PIXELS_COUNT, Image_Line::Buffer_Pixels, Image_Line::BUFFER_PIXELS_COUNT, Image_Line::Bytes_per_Pixel, Data_Block::count_of(), Image_Line::ID, Image_Line::Image_Pixels, Instrument::MAX_PIXEL_VALUES, Data_Component::put(), and Image_Line::Virtual_Pixels.

◆ pixel_count() [1/2]

unsigned int pixel_count ( ) const
inline

Gets the total number of pixels in the line.

This is the same as the total of count_of (Buffer_Pixels) (i.e. the constant BUFFER_PIXELS_COUNT), plus count_of (Image_Pixels), plus count_of (Black_Pixels) (i.e. the constant BLACK_PIXELS_COUNT), plus count_of (Virtual_Pixels) (typically 0, but the instrument manufacturer has been known to add these in some sample data sets).

Returns
The line length.

References Image_Line::Pixels_per_Line.

Referenced by Image_Line::Image_Line(), main(), Line_Cache::reset(), and Observation::reset_line().

◆ pixel_count() [2/2]

Image_Line & pixel_count ( unsigned int  total_pixels)

Sets the total number of pixels in the line.

The structure of the component data block - both Element offsets and array counts - is adjusted accordingly.

The total number of pixels must include the BUFFER_PIXELS_COUNT and BLACK_PIXELS_COUNT. The remainder is allocated to the Image_Pixels Element. However, the number of Image_Pixels can not exceed the number of Instrument::CCD_IMAGES_SENSORS; any extra pixels are allocated as the Virtual_Pixels.

Parameters
total_pixelsThe total number of pixels for the line.
Returns
This Image_Line.
Exceptions
length_errorIf total_pixels is outside the allowable range of (BUFFER_PIXELS_COUNT + BLACK_PIXELS_COUNT) to MAX_PIXELS_PER_LINE.

References Image_Line::BLACK_PIXELS_COUNT, Image_Line::BUFFER_PIXELS_COUNT, Image_Line::Bytes_per_Pixel, Instrument::CCD_IMAGE_SENSORS, Data_Block::count_of(), Image_Line::Data_Cache, Image_Line::ID, Image_Line::Image_Pixels, Image_Line::LINE_HEADER_BYTES, Image_Line::MAX_PIXELS_PER_LINE, Image_Line::Pixels_per_Line, Data_Component::resize(), Data_Block::size_of(), and Image_Line::Virtual_Pixels.

◆ pixel_bytes() [1/2]

unsigned int pixel_bytes ( ) const

Gets the number of bytes per pixel.

Returns
The size of a pixel in bytes.

References Image_Line::Image_Pixels, and Data_Block::value_size_of().

Referenced by Image_Line::Image_Line(), Observation::line(), Image_Line::lookup(), main(), Image_Line::pukool(), Line_Cache::reset(), and Observation::reset_line().

◆ pixel_bytes() [2/2]

Image_Line & pixel_bytes ( unsigned int  bytes_per_pixel)

Sets the number of bytes per pixel.

The structure of the component data block - Element offsets - is adjusted accordingly.

Parameters
bytes_per_pixelThe number of bytes per pixel.
Returns
This Image_Line.
Exceptions
out_of_rangeIf bytes_per_pixel is outside the allowable range of 1 to MAX_BYTES_PER_PIXEL.

References Image_Line::Black_Pixels, Image_Line::Buffer_Pixels, Image_Line::Bytes_per_Pixel, Data_Block::count_of(), Image_Line::Data_Cache, Image_Line::ID, Image_Line::Image_Pixels, Image_Line::LINE_HEADER_BYTES, Instrument::MAX_BYTES_PER_PIXEL, Image_Line::Pixels_per_Line, Data_Component::resize(), Data_Block::size_of(), and Image_Line::Virtual_Pixels.

◆ total_lines() [1/2]

unsigned int total_lines ( ) const
inline

Gets the total number of image lines in the channel data set.

This includes both calibration and exposed image lines.

Returns
The number of lines to be expected.

References Image_Line::Total_Lines.

Referenced by main(), Observation::PVL_PDS(), Line_Cache::reset(), and Observation::reset_line().

◆ total_lines() [2/2]

Image_Line & total_lines ( unsigned int  lines)

Sets the total number of image lines in the channel data set.

This includes both calibration and exposed image lines.

N.B.: The count of the number of lines that have been read is reset to 0, as is the number of image data bytes that have been read.

Parameters
linesThe maximum number of lines to be read.
Returns
This Image_Line.
See also
lines_read()
bytes_read()
read(std::istream&)

References Image_Line::Data_Cache, Line_Cache::reset(), and Image_Line::Total_Lines.

◆ calibration_lines() [1/2]

static unsigned int calibration_lines ( )
inlinestatic

Gets the number of image lines designated as calibration data.

Returns
The number of calibration data lines.

References Image_Line::Calibration_Lines.

Referenced by main(), Image_Line::PVL_description(), Observation::PVL_PDS(), and Observation::reset_line().

◆ calibration_lines() [2/2]

void calibration_lines ( unsigned int  lines)
static

Sets the number of image lines designated as calibration data.

While the number of image lines designated as calibration data is really an observation characteristic (does not affect the structure of an Image_Line), it is used, along with the number of total lines, when generating line information for the PDS label.

N.B.: The effective number of calibration lines is not allowed to be greater than the total number of image lines; i.e. the specified number of calibration lines is the maximum number to be designated for the observation.

Parameters
linesThe number of calibration lines.
See also
Calibration_Lines
total_lines(unsigned int)
PVL_description()

References Image_Line::Calibration_Lines.

◆ mirror()

void mirror ( )

Mirrors the order of all pixels.

Each of the HiRISE instrument 14 CCD assemblies is composed of two data channels - each getting its data from a CCD sensor device - aligned such that channel 0 is logically on the right, and channel 1 on the left, of a continuous linear pixel sensor array. Each CCD assembly has an electronics module (CPMM) that reads image data from the center of each CCD assembly. Thus channel 0 pixels are read out in reverse order from channel 1 resulting in channel 1 pixels having a logically mirrored view of the observation. However, the initial Buffer_Pixels are always read out first and the Black_Pixels are always read out last, so mirroring is applied to the image pixels segment independently. This method may be applied to reverse the ordering of image pixels to reflect the observation channel 1 pixels into the order consistent with the scene.

Warning: The pixel reordering is done independently of the Image_Line structure with the presumption that the structure is reversed and needs to be corrected. Thus this method should only be applied to an Image_Line by an application that knows, a priori, that the data order needs be corrected. If applied to correctly ordered data the resulting order will no longer be consistent with the actual image scene. Think at least twice before using this method!

N.B.: Only the image pixels are reordered. The other Image_Line segments remain as delivered by the instrument.

Note: The byte order of multibyte pixels is not changed. Each pixel retains its bytes in the same order, only the order of the pixels in the line is changed.

See also
PIRL::reorder_bytes(unsigned char*, const unsigned long, const unsigned int)

References Image_Line::Buffer_Pixels, Image_Line::Bytes_per_Pixel, Data_Block::count_of(), Image_Line::Image_Pixels, Image_Line::LINE_HEADER_BYTES, reorder_bytes(), and Data_Block::size_of().

Referenced by Observation::line(), and main().

◆ lookup()

Image_Line & lookup ( const LUT lut)

Applies a LUT mapping to all pixel values.

Each pixel value is used as the index into the LUT to find a replacement single byte pixel value. The data value mapping is done in-place using the existing data block. N.B.: This method always reults in a one byte per pixel Image_Line.

If the number of pixel bytes is 1, then each pixel value is scaled up to 14-bits before being used as the index into the lut table for a replacement value. However, a pixel value of 0xFF is left unchanged which preserves gap data values.

For two byte pixels, any pixel value over the 14-bit limit results in an output pixel value of 0xFF; this has the effect of preserving gap data values and mapping out-of-range values to bad data values. The Image_Line is restructured as one byte per pixel.

Parameters
lutThe LUT to be applied.
Returns
This Image_Line.
See also
pixel_bytes(unsigned int)

References Image_Line::Bytes_per_Pixel, Image_Line::LINE_HEADER_BYTES, Instrument::MAX_PIXEL_VALUES, Image_Line::pixel(), and Image_Line::pixel_bytes().

◆ pukool()

Image_Line & pukool ( Pixel_type table)

Applies a "reverse" table mapping to all pixel values.

The reverse mapping table is an array of 256 Pixel_type values. An input single byte pixel value is used as the index into the table to select the output value. Note: This mapping produces a multi-byte result from a single byte input.

The mapping is applied only if this Image_Line contains single byte pixels. The mapping is done in-place by utilizing the portion of the Data_Component MAX_COMPONENT_BYTES unoccupied by pixel data. The Image_Line is restructured to contain Pixel_type data.

Note: Entry 255 of the table is expected to contain the special value 65535 (0xFFFF) which ensures that gap pixel values retain gap pixel values.

Parameters
tableAn array of 256 Pixel_type values.
Returns
This Image_Line.

References Image_Line::Bytes_per_Pixel, Data_Component::data(), Image_Line::LINE_HEADER_BYTES, Image_Line::pixel(), Image_Line::pixel_bytes(), and Image_Line::Pixels_per_Line.

Referenced by main().

◆ source() [1/2]

istream & source ( ) const

Gets the istream being used as the source of line data.

Returns
An istream.
Exceptions
invalid_argumentIf the Image_Line has no data source.
See also
source(std::istream&)

References Image_Line::Data_Cache, Image_Line::ID, and Line_Cache::source().

Referenced by Observation::reset_line().

◆ source() [2/2]

Image_Line & source ( std::istream &  stream)

Sets the input stream to be used as the source of line data.

N.B.: The line data cache is reset, which includes setting the count of the number of bytes_read to 0.

Parameters
streamThe istream that will be used as the source of observation image data.
Returns
This Image_Line.

References Image_Line::Data_Cache, Image_Line::FELICS_Sync_Type, Image_Line::Line_Header_Sync_Type, Image_Line::next_sync(), Image_Line::No_Sync_Type, and Line_Cache::source().

◆ next()

bool next ( )

Gets the next image line.

The data cache is advanced to place the line data at the location of the next logical image line. If the next image line in the source stream is invalid - either because its line header does not indicate the correct next line number or because the following sync pattern is not at the correct location in the data stream - then a gap line containing the correct line header but with all pixels having gap data values is provided for the line data.

A count of the number of lines advanced since the source for this Image_Line was specified, or the total_lines count was last set, is maintained.

Returns
true if the next line of image data was obtained; false otherwise.
Exceptions
std::ios::failureIf the cache could not be refilled from the stream.
See also
count()
total_lines(unsigned int)
source(std::istream&)
synchronization_lost()

References Image_Line::Data_Cache, and Line_Cache::next_line().

Referenced by Observation::line().

◆ count()

unsigned int count ( ) const

Gets the current line count.

The returned value is the count of the number of lines that have been advanced since this Image_Line was constructed or the number of total_lines was set. This should be one more than the value of the line_number (if any lines have been read).

Returns
The current line number.
See also
total_lines(unsigned int)
next()

References Line_Cache::count(), and Image_Line::Data_Cache.

Referenced by Observation::line(), Observation::line_count(), Image_Line::print(), and Image_Line::PVL().

◆ bytes_read()

unsigned long long bytes_read ( ) const

Gets the number of bytes read from the data source.

When the data source reset to a new stream, or the total number of lines to be expected is reset, the number of bytes read is reset to 0.

N.B.: The number of bytes read is not necessarily the total amount of line data provided. Only bytes read from the source stream are counted. Invalid lines replaced with gap data are not counted.

Returns
The total number of image data bytes read from the source stream.
See also
next()

References Line_Cache::bytes_read(), and Image_Line::Data_Cache.

Referenced by Observation::line(), and main().

◆ source_bytes()

unsigned long long source_bytes ( ) const

Gets the amount (bytes) of source data that has been used.

The amount of source data that was used to generate image lines, excluding any fill data, is returned. N.B.: This value will be less than or greater than the number of bytes read if the reconstruction of damaged image lines resulted in excess source data being dropped, or padded with gap fill values to replace missing data, respectively.

Returns
The number of source bytes used to generate image lines.

References Image_Line::Data_Cache, and Line_Cache::source_bytes().

Referenced by main().

◆ compressed_data()

bool compressed_data ( ) const

Indicates if the source line data was FELICS compressed.

Returns
true if the image data source is FELICS compressed; false otherwise.

References Line_Cache::compressed_data(), and Image_Line::Data_Cache.

Referenced by main(), and Observation::PVL_PDS().

◆ compressed_bytes()

unsigned long long compressed_bytes ( ) const

Gets the amount (bytes) of compressed data that has been processed.

Returns
The number of bytes of compressed data that have been processed since the last cache reset.
See also
reset()
source(std::istream&)

References Line_Cache::compressed_bytes(), and Image_Line::Data_Cache.

Referenced by main().

◆ decompressed_bytes()

unsigned long long decompressed_bytes ( ) const

Gets the amount (bytes) of decompressed data that has been generated.

Returns
The number of bytes of decompressed data that have been generated since the last cache reset.
See also
reset()
source(std::istream&)

References Image_Line::Data_Cache, and Line_Cache::decompressed_bytes().

Referenced by main().

◆ cache()

Line_Cache* cache ( )
inline

Gets the line's data management cache object.

WARNING <<< The Line_Cache object is intended for use by the

cache management system. It has direct control over the line's data contents using the istream source to supply data input.

Returns
A pointer to the line's Line_Cache object. This will be NULL if the line is not attached to a source stream that would be used by the Line_Cache to provide structured line data input.

References Image_Line::Data_Cache.

Referenced by Line_Cache::next_line().

◆ synchronization_lost()

bool synchronization_lost ( )

◆ print()

ostream & print ( std::ostream &  stream = std::cout,
bool  verbose = false 
) const
virtual

Prints the component structure and contents.

After listing the line header Elements each of the pixel Element portions is listed. The space separated pixel values are listed in width groups per line with the beginning of each line having the index number of the first Element pixel followed by a colon (':') character.

Parameters
streamThe ostream where the listing will be written.
verbosetrue if the listing is to start with the class ID.
Returns
The stream that was written.
See also
Data_Component::print(std::ostream&, bool) const

Implements Data_Component.

References Image_Line::bad_line(), Image_Line::Black_Pixels, Image_Line::Buffer_Pixels, Image_Line::Channel, Image_Line::channel(), Image_Line::count(), Data_Block::count_of(), Data_Component::HEX, Image_Line::ID, Image_Line::Image_Pixels, Image_Line::Line_Number, Image_Line::line_number(), Image_Line::NAME, Image_Line::pixel(), Data_Component::print_element_location(), UA::HiRISE::print_value(), Data_Block::size_of(), Image_Line::Sync, Image_Line::SYNC, Image_Line::sync(), Data_Block::value_size_of(), Image_Line::Virtual_Pixels, Image_Line::width(), and Image_Line::Width.

Referenced by main(), and Line_Cache::next_line().

◆ width() [1/2]

unsigned int width ( ) const
inline

Gets the print listing width.

Returns
The number of pixel groups per line.
See also
print(std::ostream&, bool) const

References Image_Line::Width.

Referenced by FELICS_Line_Cache::decompress(), and Image_Line::print().

◆ width() [2/2]

Image_Line& width ( unsigned int  groups)
inline

Sets the print listing width.

The DEFAULT_WIDTH applies if no other width has been set.

Parameters
groupsThe number of pixel groups per line.
Returns
This Image_Line.
See also
print(std::ostream&, bool) const

References Image_Line::Width.

◆ PVL()

Aggregate * PVL ( ) const
virtual

◆ PVL_description()

Aggregate * PVL_description ( ) const

Produces a PVL description of the observation image data layout for a PDS label.

The description is an OBJECT that contains the PDS parameters required to describe a data product binary data object. The Aggregate that is produced contains two sets of Parameter Objects: one for the initial calibration lines, where the object names all begin with "CALIBRATION_", and another for the exposed scene image lines. For each set a "LINE_PREFIX_TABLE" Object, "LINE_SUFFIX_TABLE" Object and "IMAGE" Object are provided. The returned Aggregate contains copies of static template Objects. In the copies the variable parameters that characterize the specific Image_Line structure are reset appropriately.

N.B.: The effective number of calibration lines will be set to the total number of lines if the specified number of calibration lines exceeds the total number of lines at the time that the PVL is generated. The specified number of calibration lines will remain unchanged in any case.

Returns
A pointer to a PVL::Aggregate.

References Image_Line::Black_Pixels, Image_Line::BLACK_PIXELS_COUNT, Image_Line::Buffer_Pixels, Image_Line::Bytes_per_Pixel, Image_Line::Calibration_Lines, Image_Line::calibration_lines(), Parameter::comment(), Aggregate::copy_in(), Data_Block::count_of(), Parser::get_parameters(), Image_Line::ID, Image_Line::Image_Pixels, Image_Line::LINE_HEADER_BYTES, Instrument::MAX_PIXEL_VALUES, Parameter::name(), Data_Block::offset_of(), UA::HiRISE::PVL_parameter(), UA::HiRISE::PVL_value(), Data_Block::size_of(), Image_Line::Total_Lines, Parameter::value(), and Image_Line::Virtual_Pixels.

Referenced by Observation::PVL_PDS().

◆ is_valid()

bool is_valid ( ) const
virtual

Tests if the component data is valid.

The sync value must match the SYNC constant, and the number of lines_read must be one more that the line_number.

Returns
true if the component has valid data; false otherwise.

Implements Data_Component.

References Image_Line::SYNC, and Image_Line::sync().

◆ is_sync()

bool is_sync ( void *  data_at)
static

Tests if some data contains a line header sync pattern.

The data must contain at least 3, MSB ordered, bytes having a Image_Line::SYNC value for the test to be true.

Parameters
data_atA pointer to the data to be tested.
Returns
true if the data contains a SYNC value; false otherwise.

References Image_Line::SYNC, and Image_Line::SYNC_1_BIT_MASK.

Referenced by Image_Line::next_sync().

◆ next_sync()

Image_Line::Sync_Type next_sync ( std::istream &  stream)
static

Searches an istream for an image data synchronization pattern.

The data from the stream is incrementally searched for the presence of either a line header sync pattern or a FELICS data block sync pattern. The first occurance of either determines the Sync_Type returned. If neither can be found in the entire file a value of No_Sync_Type is returned.

WARNING <<< The input stream must be seekable. The file is

repositioned back to its position at the start of the search before the function returns.

Parameters
streamThe istream to be searched.
Returns
A Sync_Type value.
See also
is_sync(void*)
FELICS_Line_Cache::is_sync(void*)

References Data_Component::data(), Image_Line::FELICS_Sync_Type, Image_Line::ID, FELICS_Line_Cache::is_sync(), Image_Line::is_sync(), Image_Line::Line_Header_Sync_Type, Image_Line::No_Sync_Type, FELICS_Line_Cache::SYNC_BYTES, SYNC_SEARCH_BUFFER_SIZE, and Image_Line::Sync_Type_Names.

Referenced by Image_Line::source().

Member Data Documentation

◆ ID

const char *const ID
static

◆ NAME

const char *const NAME = "Image Line"
static

The component name.

Referenced by Image_Line::name(), Image_Line::print(), and Image_Line::PVL().

◆ NAMES

const char * NAMES
static
Initial value:
=
{
"SYNC",
"CHANNEL",
"LINE_NUMBER",
"BUFFER_PIXELS",
"IMAGE_PIXELS",
"BLACK_PIXELS",
"VIRTUAL_PIXELS",
NULL
}

The name of each Element.

Referenced by Image_Line::PVL().

◆ LINE_HEADER_BYTES

const unsigned int LINE_HEADER_BYTES = 6
static

◆ BUFFER_PIXELS_COUNT

const unsigned int BUFFER_PIXELS_COUNT = 12
static

◆ BLACK_PIXELS_COUNT

const unsigned int BLACK_PIXELS_COUNT = 16
static

◆ MAX_VIRTUAL_PIXELS_COUNT

const unsigned int MAX_VIRTUAL_PIXELS_COUNT = MAX_VIRTUAL_PIXELS
static

The maximum number of allowable virtual pixels.

◆ MAX_PIXELS_PER_LINE

const unsigned int MAX_PIXELS_PER_LINE
static
Initial value:
=
(
)
static const unsigned int MAX_VIRTUAL_PIXELS_COUNT
The maximum number of allowable virtual pixels.
Definition: Image_Line.hh:167
static const unsigned int BLACK_PIXELS_COUNT
The number of black pixels.
Definition: Image_Line.hh:164
static const unsigned int BUFFER_PIXELS_COUNT
The number of buffer pixels.
Definition: Image_Line.hh:161
static const unsigned int CCD_IMAGE_SENSORS

The maximum number of pixels allowed.

This value is the total of the BUFFER_PIXELS_COUNT, Instrument::CCD_IMAGE_SENSORS, BLACK_PIXELS_COUNT, and MAX_VIRTUAL_PIXELS_COUNT.

Referenced by Image_Line::pixel_count().

◆ DEFAULT_CALIBRATION_LINES

const unsigned int DEFAULT_CALIBRATION_LINES = CALIBRATION_LINES
static

The default number of calibration lines at the beginning of the observation channel data.

The pixel data in these lines are not a result of being exposed to the viewing optics, or are for other reasons not to be included in the scene image data lines. These lines are used to calibrate the following image data lines for the effects of instrument electronics.

Referenced by main(), Observation::reset_line(), and usage().

◆ MAX_COMPONENT_BYTES

const Index MAX_COMPONENT_BYTES
static
Initial value:
=
static const unsigned int LINE_HEADER_BYTES
The number of bytes in the line header section.
Definition: Image_Line.hh:158
static const unsigned int MAX_PIXELS_PER_LINE
The maximum number of pixels allowed.
Definition: Image_Line.hh:176
static const unsigned int MAX_BYTES_PER_PIXEL

Total maximum number of bytes in the Data_Block.

◆ OFFSETS_TEMPLATE

const Index OFFSETS_TEMPLATE
static
Initial value:

Data_Block data storage address offset template for each Element.

The template is used to construct a default Image_Line with MAX_BYTES_PER_PIXEL, Instrument::CCD_IMAGE_SENSORS image pixels, and no virtual pixels.

◆ ARRAY_COUNTS_TEMPLATE

const Index ARRAY_COUNTS_TEMPLATE
static
Initial value:
=
{
{0,0}
}
@ Black_Pixels
Definition: Image_Line.hh:145
@ Virtual_Pixels
Definition: Image_Line.hh:146
@ Buffer_Pixels
Definition: Image_Line.hh:143
@ Image_Pixels
Definition: Image_Line.hh:144

Data_Block array element value counts each keyed to an Element Index.

All values of an array element are the same size (the total size of the Element divided by the count of array entries). Any Element not listed here has only one value.

The template is used to construct a default Image_Line with Instrument::CCD_IMAGE_SENSORS image pixels, and no virtual pixels.

ARRAY_COUNTS[*][0]
An Element Index.
ARRAY_COUNTS[*][1]
The number of array values for the indexed Element.
This list must be zero-terminated.

@see    Data_Block::size_of(Index)
@see    Data_Block::count_of(Index)

◆ SYNC

const u_int_32 SYNC = 0xFF00E000
static

Expected Sync Element value after extension.

The Sync Element contains the most significant bytes of a 32-bit value. The least significant byte has a value of 0. The remaining byte (1) is the Channel Element value with the CHANNEL_BIT_MASK lower bits set to 0 (only the upper SYNC_1_BIT_MASK bits are used).

Referenced by Image_Line::Image_Line(), Image_Line::is_sync(), Image_Line::is_valid(), Line_Cache::next_line(), Image_Line::print(), and Image_Line::PVL().

◆ SYNC_3

const u_int_8 SYNC_3 = 0xFF
static

Expected Sync Element MSB (byte 3) value.

See also
SYNC

◆ SYNC_2

const u_int_8 SYNC_2 = 0x00
static

Expected Sync Element MSB+1 (byte 2) value.

See also
SYNC

◆ SYNC_1_BIT_MASK

const u_int_8 SYNC_1_BIT_MASK = 0xE0
static

Bit mask for the Sync Element extension field of the Channel Element.

See also
SYNC

Referenced by Image_Line::is_sync(), and Image_Line::sync().

◆ CHANNEL_BIT_MASK

const u_int_8 CHANNEL_BIT_MASK = 0x1F
static

Bit mask for channel number field of the Channel Element.

Referenced by Image_Line::channel().

◆ LINE_NUMBER_MASK

const u_int_32 LINE_NUMBER_MASK = 0x007FFFFF
static

Bit mask for the line number field of the Line_Number Element.

For EDR products the most significant bit of the Line_Number Element is reserved as a bad line flag. The bad line flag will only be set when the source observation image data was found to have a damaged structure for the line.

Referenced by Image_Line::bad_line(), and Image_Line::line_number().

◆ Sync_Type_Names

const char * Sync_Type_Names
static
Initial value:
=
{
"None",
"Line header",
"FELICS"
}

Sync_Type names.

Referenced by Image_Line::next_sync().

◆ DEFAULT_WIDTH

const unsigned int DEFAULT_WIDTH = LINE_PRINT_GROUPS_WIDTH
static

The default width, in pixel groups, of a print listing.

◆ Calibration_Lines

unsigned int Calibration_Lines = CALIBRATION_LINES
static

Number of image lines at the beginning of the image data to be designated as calibration data.

Default number of calibration lines.

The pixel data in these lines are not a result of being exposed to the viewing optics, or are for other reasons not to be included in the scene image data lines. These lines are expected to be used to calibrate the following image data lines for the effects of instrument electronics.

Referenced by Image_Line::calibration_lines(), and Image_Line::PVL_description().

◆ Pixels_per_Line

unsigned int Pixels_per_Line
protected

◆ Bytes_per_Pixel

unsigned int Bytes_per_Pixel
protected

◆ Total_Lines

unsigned int Total_Lines
protected

◆ Channel_Number

unsigned int Channel_Number
protected

◆ Data_Cache

Line_Cache* Data_Cache
protected

◆ Width

unsigned int Width
protected

Width of listing (pixel groups).

Referenced by Image_Line::print(), and Image_Line::width().


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