Panda3D
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Friends | List of all members
PfmFile Class Reference

Defines a pfm file, a 2-d table of floating-point numbers, either 3-component or 1-component, or with a special extension, 2- or 4-component. More...

#include "pfmFile.h"

Inheritance diagram for PfmFile:
PNMImageHeader

Public Member Functions

 PfmFile (const PfmFile &copy)
 
void add_sub_image (const PfmFile &copy, int xto, int yto, int xfrom=0, int yfrom=0, int x_size=-1, int y_size=-1, float pixel_scale=1.0)
 Behaves like copy_sub_image(), except the copy pixels are added to the pixels of the destination, after scaling by the specified pixel_scale.
 
void apply_1d_lut (int channel, const PfmFile &lut, PN_float32 x_scale=1.0)
 Assumes that lut is an X by 1, 1-component PfmFile whose X axis maps points to target points.
 
void apply_crop (int x_begin, int x_end, int y_begin, int y_end)
 Reduces the PFM file to the cells in the rectangle bounded by (x_begin, x_end, y_begin, y_end), where the _end cells are not included.
 
void apply_exponent (float c0_exponent, float c1_exponent, float c2_exponent)
 Adjusts each channel of the image by raising the corresponding component value to the indicated exponent, such that L' = L ^ exponent.
 
void apply_exponent (float c0_exponent, float c1_exponent, float c2_exponent, float c3_exponent)
 Adjusts each channel of the image by raising the corresponding component value to the indicated exponent, such that L' = L ^ exponent.
 
void apply_exponent (float gray_exponent)
 Adjusts each channel of the image by raising the corresponding component value to the indicated exponent, such that L' = L ^ exponent.
 
void apply_exponent (float gray_exponent, float alpha_exponent)
 Adjusts each channel of the image by raising the corresponding component value to the indicated exponent, such that L' = L ^ exponent.
 
void apply_mask (const PfmFile &other)
 Wherever there is missing data in the other PfmFile, set this the corresponding point in this PfmFile to missing as well, so that this PfmFile has only points where both files have points.
 
void box_filter_from (float radius, const PfmFile &copy)
 Makes a resized copy of the indicated image into this one using the indicated filter.
 
bool calc_autocrop (int &x_begin, int &x_end, int &y_begin, int &y_end) const
 Computes the minimum range of x and y across the PFM file that include all points.
 
bool calc_autocrop (LVecBase4d &range) const
 Computes the minimum range of x and y across the PFM file that include all points.
 
bool calc_autocrop (LVecBase4f &range) const
 Computes the minimum range of x and y across the PFM file that include all points.
 
bool calc_average_point (LPoint3f &result, PN_float32 x, PN_float32 y, PN_float32 radius) const
 Computes the unweighted average point of all points within the box centered at (x, y) with the indicated Manhattan-distance radius.
 
bool calc_bilinear_point (LPoint3f &result, PN_float32 x, PN_float32 y) const
 Computes the weighted average of the four nearest points to the floating- point index (x, y).
 
bool calc_min_max (LVecBase3f &min_points, LVecBase3f &max_points) const
 Calculates the minimum and maximum x, y, and z depth component values, representing the bounding box of depth values, and places them in the indicated vectors.
 
bool calc_tight_bounds (LPoint3f &min_point, LPoint3f &max_point) const
 Calculates the minimum and maximum vertices of all points within the table.
 
void clear ()
 Eliminates all data in the file.
 
void clear (int x_size, int y_size, int num_channels)
 Resets to an empty table with a specific size.
 
void clear_no_data_value ()
 Removes the special value that means "no data" when it appears in the pfm file.
 
void clear_to_texcoords (int x_size, int y_size)
 Replaces this PfmFile with a new PfmFile of size x_size x y_size x 3, containing the x y 0 values in the range 0 .
 
void compute_sample_point (LPoint3f &result, PN_float32 x, PN_float32 y, PN_float32 sample_radius) const
 
void copy_channel (int to_channel, const PfmFile &other, int from_channel)
 Copies just the specified channel values from the indicated PfmFile (which could be same as this PfmFile) into the specified channel of this one.
 
void copy_channel_masked (int to_channel, const PfmFile &other, int from_channel)
 Copies just the specified channel values from the indicated PfmFile, but only where the other file has a data point.
 
void copy_sub_image (const PfmFile &copy, int xto, int yto, int xfrom=0, int yfrom=0, int x_size=-1, int y_size=-1)
 
void divide_sub_image (const PfmFile &copy, int xto, int yto, int xfrom=0, int yfrom=0, int x_size=-1, int y_size=-1, float pixel_scale=1.0)
 Behaves like copy_sub_image(), except the copy pixels are divided into the pixels of the destination, after scaling by the specified pixel_scale.
 
void fill (const LPoint2f &value)
 Fills the table with all of the same value.
 
void fill (const LPoint3f &value)
 Fills the table with all of the same value.
 
void fill (const LPoint4f &value)
 Fills the table with all of the same value.
 
void fill (PN_float32 value)
 Fills the table with all of the same value.
 
void fill_channel (int channel, PN_float32 value)
 Fills the indicated channel with all of the same value, leaving the other channels unchanged.
 
void fill_channel_masked (int channel, PN_float32 value)
 Fills the indicated channel with all of the same value, but only where the table already has a data point.
 
void fill_channel_masked_nan (int channel)
 Fills the indicated channel with NaN, but only where the table already has a data point.
 
void fill_channel_nan (int channel)
 Fills the indicated channel with NaN, leaving the other channels unchanged.
 
void fill_nan ()
 Fills the table with all NaN.
 
void fill_no_data_value ()
 Fills the table with the current no_data value, so that the table is empty.
 
void flip (bool flip_x, bool flip_y, bool transpose)
 Reverses, transposes, and/or rotates the table in-place according to the specified parameters.
 
void forward_distort (const PfmFile &dist, PN_float32 scale_factor=1.0)
 Applies the distortion indicated in the supplied dist map to the current map.
 
void gamma_correct (float from_gamma, float to_gamma)
 
void gamma_correct_alpha (float from_gamma, float to_gamma)
 Assuming the image was constructed with a gamma curve of from_gamma in the alpha channel, converts it to an image with a gamma curve of to_gamma in the alpha channel.
 
void gaussian_filter_from (float radius, const PfmFile &copy)
 Makes a resized copy of the indicated image into this one using the indicated filter.
 
PN_float32 get_channel (int x, int y, int c) const
 Returns the cth channel of the point value at the indicated point.
 
const LPoint4f & get_no_data_value () const
 If has_no_data_value() returns true, this returns the particular "no data" value.
 
const LPoint3f & get_point (int x, int y) const
 Returns the 3-component point value at the indicated point.
 
PN_float32 get_point1 (int x, int y) const
 Returns the 1-component point value at the indicated point.
 
const LPoint2f & get_point2 (int x, int y) const
 Returns the 2-component point value at the indicated point.
 
const LPoint3f & get_point3 (int x, int y) const
 Returns the 3-component point value at the indicated point.
 
const LPoint4f & get_point4 (int x, int y) const
 Returns the 4-component point value at the indicated point.
 
PN_float32 get_scale () const
 
const vector_float & get_table () const
 This is a very low-level function that returns a read-only reference to the internal table of floating-point numbers.
 
bool has_no_data_threshold () const
 Returns whether a "no data" threshold value has been established by set_no_data_threshold().
 
bool has_no_data_value () const
 Returns whether a "no data" value has been established by set_no_data_value().
 
bool has_point (int x, int y) const
 Returns true if there is a valid point at x, y.
 
void indirect_1d_lookup (const PfmFile &index_image, int channel, const PfmFile &pixel_values)
 index_image is a WxH 1-channel image, while pixel_values is an Nx1 image with any number of channels.
 
bool is_column_empty (int x, int y_begin, int y_end) const
 Returns true if all of the points on column x, from [y_begin, y_end), are the no_data value, or false if any one of these points has a value.
 
bool is_row_empty (int y, int x_begin, int x_end) const
 Returns true if all of the points on row y, in the range [x_begin, x_end), are the no_data value, or false if any one of these points has a value.
 
bool is_valid () const
 
bool load (const PNMImage &pnmimage)
 Fills the PfmFile with the data from the indicated PNMImage, converted to floating-point values.
 
void merge (const PfmFile &other)
 Wherever there is missing data in this PfmFile (that is, wherever has_point() returns false), copy data from the other PfmFile, which must be exactly the same dimensions as this one.
 
LPoint3f & modify_point (int x, int y)
 Returns a modifiable 3-component point value at the indicated point.
 
LPoint2f & modify_point2 (int x, int y)
 Returns a modifiable 2-component point value at the indicated point.
 
LPoint3f & modify_point3 (int x, int y)
 Returns a modifiable 3-component point value at the indicated point.
 
LPoint4f & modify_point4 (int x, int y)
 Returns a modifiable 4-component point value at the indicated point.
 
void mult_sub_image (const PfmFile &copy, int xto, int yto, int xfrom=0, int yfrom=0, int x_size=-1, int y_size=-1, float pixel_scale=1.0)
 Behaves like copy_sub_image(), except the copy pixels are multiplied to the pixels of the destination, after scaling by the specified pixel_scale.
 
void operator*= (float multiplier)
 Multiplies every point value in the image by a constant floating-point multiplier value.
 
void operator= (const PfmFile &copy)
 
void output (std::ostream &out) const
 
 PT (BoundingHexahedron) compute_planar_bounds(const LPoint2d &center
 
 PT (BoundingHexahedron) compute_planar_bounds(const LPoint2f &center
 
int pull_spot (const LPoint4f &delta, float xc, float yc, float xr, float yr, float exponent)
 Applies delta * t to the point values within radius (xr, yr) distance of (xc, yc).
 
void quick_filter_from (const PfmFile &copy)
 Resizes from the given image, with a fixed radius of 0.5.
 
bool read (const Filename &fullpath)
 Reads the PFM data from the indicated file, returning true on success, false on failure.
 
bool read (PNMReader *reader)
 Reads the PFM data using the indicated PNMReader.
 
bool read (std::istream &in, const Filename &fullpath=Filename())
 Reads the PFM data from the indicated stream, returning true on success, false on failure.
 
void resize (int new_x_size, int new_y_size)
 Applies a simple filter to resample the pfm file in-place to the indicated size.
 
void reverse_distort (const PfmFile &dist, PN_float32 scale_factor=1.0)
 Applies the distortion indicated in the supplied dist map to the current map.
 
void reverse_rows ()
 Performs an in-place reversal of the row (y) data.
 
void set_channel (int x, int y, int c, PN_float32 value)
 Replaces the cth channel of the point value at the indicated point.
 
void set_no_data_chan4 (bool chan4)
 Sets the no_data_chan4 flag.
 
void set_no_data_nan (int num_channels)
 Sets the no_data_nan flag.
 
void set_no_data_threshold (const LPoint4d &no_data_value)
 Sets the special threshold value.
 
void set_no_data_threshold (const LPoint4f &no_data_value)
 Sets the special threshold value.
 
void set_no_data_value (const LPoint4d &no_data_value)
 Sets the special value that means "no data" when it appears in the pfm file.
 
void set_no_data_value (const LPoint4f &no_data_value)
 Sets the special value that means "no data" when it appears in the pfm file.
 
void set_point (int x, int y, const LVecBase3d &point)
 Replaces the 3-component point value at the indicated point.
 
void set_point (int x, int y, const LVecBase3f &point)
 Replaces the 3-component point value at the indicated point.
 
void set_point1 (int x, int y, PN_float32 point)
 Replaces the 1-component point value at the indicated point.
 
void set_point2 (int x, int y, const LVecBase2d &point)
 Replaces the 2-component point value at the indicated point.
 
void set_point2 (int x, int y, const LVecBase2f &point)
 Replaces the 2-component point value at the indicated point.
 
void set_point3 (int x, int y, const LVecBase3d &point)
 Replaces the 3-component point value at the indicated point.
 
void set_point3 (int x, int y, const LVecBase3f &point)
 Replaces the 3-component point value at the indicated point.
 
void set_point4 (int x, int y, const LVecBase4d &point)
 Replaces the 4-component point value at the indicated point.
 
void set_point4 (int x, int y, const LVecBase4f &point)
 Replaces the 4-component point value at the indicated point.
 
void set_scale (PN_float32 scale)
 
void set_zero_special (bool zero_special)
 Sets the zero_special flag.
 
bool store (PNMImage &pnmimage) const
 Copies the data to the indicated PNMImage, converting to RGB values.
 
bool store_mask (PNMImage &pnmimage) const
 Stores 1 or 0 values into the indicated PNMImage, according to has_point() for each pixel.
 
bool store_mask (PNMImage &pnmimage, const LVecBase4f &min_point, const LVecBase4f &max_point) const
 Stores 1 or 0 values into the indicated PNMImage, according to has_point() for each pixel.
 
void swap_table (vector_float &table)
 This is a very low-level function that completely exchanges the PfmFile's internal table of floating-point numbers with whatever you supply.
 
bool write (const Filename &fullpath)
 Writes the PFM data to the indicated file, returning true on success, false on failure.
 
bool write (PNMWriter *writer)
 Writes the PFM data using the indicated PNMWriter.
 
bool write (std::ostream &out, const Filename &fullpath=Filename())
 Writes the PFM data to the indicated stream, returning true on success, false on failure.
 
void xform (const LMatrix4d &transform)
 Applies the indicated transform matrix to all points in-place.
 
void xform (const LMatrix4f &transform)
 Applies the indicated transform matrix to all points in-place.
 
- Public Member Functions inherited from PNMImageHeader
 PNMImageHeader (const PNMImageHeader &copy)
 
ColorSpace get_color_space () const
 
ColorType get_color_type () const
 Returns the image type of the image, as an enumerated value.
 
std::string get_comment () const
 
xelval get_maxval () const
 
int get_num_channels () const
 
LVecBase2i get_size () const
 
PNMFileTypeget_type () const
 
int get_x_size () const
 Returns the number of pixels in the X direction.
 
int get_y_size () const
 Returns the number of pixels in the Y direction.
 
bool has_alpha () const
 Returns true if the image includes an alpha channel, false otherwise.
 
bool has_type () const
 
bool is_grayscale () const
 Returns false if the image is a full-color image, and has red, green, and blue components; true if it is a grayscale image and has only a gray component.
 
PNMReadermake_reader (const Filename &filename, PNMFileType *type=nullptr, bool report_unknown_type=true) const
 Returns a newly-allocated PNMReader of the suitable type for reading from the indicated image filename, or NULL if the filename cannot be read for some reason.
 
PNMReadermake_reader (std::istream *file, bool owns_file=true, const Filename &filename=Filename(), std::string magic_number=std::string(), PNMFileType *type=nullptr, bool report_unknown_type=true) const
 Returns a newly-allocated PNMReader of the suitable type for reading from the already-opened image file, or NULL if the file cannot be read for some reason.
 
PNMWritermake_writer (const Filename &filename, PNMFileType *type=nullptr) const
 Returns a newly-allocated PNMWriter of the suitable type for writing an image to the indicated filename, or NULL if the filename cannot be written for some reason.
 
PNMWritermake_writer (std::ostream *file, bool owns_file=true, const Filename &filename=Filename(), PNMFileType *type=nullptr) const
 Returns a newly-allocated PNMWriter of the suitable type for writing to the already-opened image file, or NULL if the file cannot be written for some reason.
 
void operator= (const PNMImageHeader &copy)
 
void output (std::ostream &out) const
 
bool read_header (const Filename &filename, PNMFileType *type=nullptr, bool report_unknown_type=true)
 Opens up the image file and tries to read its header information to determine its size, number of channels, etc.
 
bool read_header (std::istream &data, const std::string &filename=std::string(), PNMFileType *type=nullptr, bool report_unknown_type=true)
 Reads the image header information only from the indicated stream.
 
void set_comment (const std::string &comment)
 
void set_type (PNMFileType *type)
 Sets the file type of this PNMImage.
 

Public Attributes

PN_float32 PN_float32 bool points_only const
 
 get_scale
 The "scale" is reported in the pfm header and is probably meaningless.
 
 is_valid
 
PN_float32 point_dist
 
PN_float32 PN_float32 sample_radius
 
 set_scale
 The "scale" is reported in the pfm header and is probably meaningless.
 
- Public Attributes inherited from PNMImageHeader
 get_color_space
 Returns the color space that the image is encoded in, or CS_unspecified if unknown.
 
 get_comment
 Gets the user comment from the file.
 
 get_maxval
 Returns the maximum channel value allowable for any pixel in this image; for instance, 255 for a typical 8-bit-per-channel image.
 
 get_num_channels
 Returns the number of channels in the image.
 
 get_size
 Returns the number of pixels in each direction.
 
 get_type
 If the file type is known (e.g.
 
 has_type
 Returns true if the PNMImageHeader knows what type it is, false otherwise.
 
 set_comment
 Writes a user comment string to the image (header).
 

Friends

class PfmVizzer
 

Additional Inherited Members

- Public Types inherited from PNMImageHeader
enum  ColorType {
  CT_invalid = 0 , CT_grayscale = 1 , CT_two_channel = 2 , CT_color = 3 ,
  CT_four_channel = 4
}
 
typedef pmap< PixelSpec, int > HistMap
 
typedef pvector< PixelSpecPalette
 
typedef pvector< PixelSpecCountPixelCount
 
- Static Public Member Functions inherited from PNMImageHeader
static bool has_alpha (ColorType color_type)
 This static variant of has_alpha() returns true if the indicated image type includes an alpha channel, false otherwise.
 
static bool is_grayscale (ColorType color_type)
 This static variant of is_grayscale() returns true if the indicated image type represents a grayscale image, false otherwise.
 
static bool read_magic_number (std::istream *file, std::string &magic_number, int num_bytes)
 Ensures that the first n bytes of the file are read into magic_number.
 

Detailed Description

Defines a pfm file, a 2-d table of floating-point numbers, either 3-component or 1-component, or with a special extension, 2- or 4-component.

Definition at line 31 of file pfmFile.h.

Constructor & Destructor Documentation

◆ PfmFile() [1/2]

PfmFile::PfmFile ( )

Definition at line 35 of file pfmFile.cxx.

◆ PfmFile() [2/2]

PfmFile::PfmFile ( const PfmFile & copy)

Definition at line 47 of file pfmFile.cxx.

Member Function Documentation

◆ add_sub_image()

void PfmFile::add_sub_image ( const PfmFile & copy,
int xto,
int yto,
int xfrom = 0,
int yfrom = 0,
int x_size = -1,
int y_size = -1,
float pixel_scale = 1.0 )

Behaves like copy_sub_image(), except the copy pixels are added to the pixels of the destination, after scaling by the specified pixel_scale.

Definition at line 1964 of file pfmFile.cxx.

References get_point1(), get_point2(), get_point3(), get_point4(), has_point(), set_point1(), set_point2(), set_point3(), and set_point4().

◆ apply_1d_lut()

void PfmFile::apply_1d_lut ( int channel,
const PfmFile & lut,
PN_float32 x_scale = 1.0 )

Assumes that lut is an X by 1, 1-component PfmFile whose X axis maps points to target points.

For each point in this pfm file, computes: p(u, v)[channel] = lut(p(u, v)[channel] * x_scale, 0)[0]

Definition at line 1437 of file pfmFile.cxx.

References calc_bilinear_point(), get_channel(), has_point(), and set_channel().

◆ apply_crop()

void PfmFile::apply_crop ( int x_begin,
int x_end,
int y_begin,
int y_end )

Reduces the PFM file to the cells in the rectangle bounded by (x_begin, x_end, y_begin, y_end), where the _end cells are not included.

Definition at line 1550 of file pfmFile.cxx.

Referenced by PfmTrans::process_pfm().

◆ apply_exponent() [1/4]

void PfmFile::apply_exponent ( float c0_exponent,
float c1_exponent,
float c2_exponent )
inline

Adjusts each channel of the image by raising the corresponding component value to the indicated exponent, such that L' = L ^ exponent.

For a grayscale image, the blue_exponent value is used for the grayscale value, and red_exponent and green_exponent are unused.

Definition at line 527 of file pfmFile.I.

References apply_exponent().

◆ apply_exponent() [2/4]

void PfmFile::apply_exponent ( float c0_exponent,
float c1_exponent,
float c2_exponent,
float c3_exponent )

Adjusts each channel of the image by raising the corresponding component value to the indicated exponent, such that L' = L ^ exponent.

Definition at line 2295 of file pfmFile.cxx.

◆ apply_exponent() [3/4]

void PfmFile::apply_exponent ( float gray_exponent)
inline

Adjusts each channel of the image by raising the corresponding component value to the indicated exponent, such that L' = L ^ exponent.

Definition at line 507 of file pfmFile.I.

References apply_exponent().

Referenced by apply_exponent(), apply_exponent(), apply_exponent(), and gamma_correct_alpha().

◆ apply_exponent() [4/4]

void PfmFile::apply_exponent ( float gray_exponent,
float alpha_exponent )
inline

Adjusts each channel of the image by raising the corresponding component value to the indicated exponent, such that L' = L ^ exponent.

Definition at line 516 of file pfmFile.I.

References apply_exponent().

◆ apply_mask()

void PfmFile::apply_mask ( const PfmFile & other)

Wherever there is missing data in the other PfmFile, set this the corresponding point in this PfmFile to missing as well, so that this PfmFile has only points where both files have points.

The point is set to "missing" by setting it the no_data_value.

Definition at line 1489 of file pfmFile.cxx.

References has_point(), and set_point4().

◆ box_filter_from()

void PfmFile::box_filter_from ( float width,
const PfmFile & copy )

Makes a resized copy of the indicated image into this one using the indicated filter.

The image to be copied is squashed and stretched to match the dimensions of the current image, applying the appropriate filter to perform the stretching.

Definition at line 653 of file pnm-image-filter.cxx.

Referenced by resize().

◆ calc_autocrop() [1/3]

bool PfmFile::calc_autocrop ( int & x_begin,
int & x_end,
int & y_begin,
int & y_end ) const

Computes the minimum range of x and y across the PFM file that include all points.

If there are no points with no_data_value in the grid–that is, all points are included–then this will return (0, get_x_size(), 0, get_y_size()).

Definition at line 774 of file pfmFile.cxx.

References is_column_empty(), and is_row_empty().

Referenced by calc_autocrop(), calc_autocrop(), and PfmTrans::process_pfm().

◆ calc_autocrop() [2/3]

bool PfmFile::calc_autocrop ( LVecBase4d & range) const
inline

Computes the minimum range of x and y across the PFM file that include all points.

If there are no points with no_data_value in the grid–that is, all points are included–then this will return (0, get_x_size(), 0, get_y_size()).

Definition at line 356 of file pfmFile.I.

References calc_autocrop().

◆ calc_autocrop() [3/3]

bool PfmFile::calc_autocrop ( LVecBase4f & range) const
inline

Computes the minimum range of x and y across the PFM file that include all points.

If there are no points with no_data_value in the grid–that is, all points are included–then this will return (0, get_x_size(), 0, get_y_size()).

Definition at line 342 of file pfmFile.I.

References calc_autocrop().

◆ calc_average_point()

bool PfmFile::calc_average_point ( LPoint3f & result,
PN_float32 x,
PN_float32 y,
PN_float32 radius ) const

Computes the unweighted average point of all points within the box centered at (x, y) with the indicated Manhattan-distance radius.

Missing points are assigned the value of their nearest neighbor. Returns true if successful, or false if the point value cannot be determined.

Definition at line 606 of file pfmFile.cxx.

References get_point(), and has_point().

◆ calc_bilinear_point()

bool PfmFile::calc_bilinear_point ( LPoint3f & result,
PN_float32 x,
PN_float32 y ) const

Computes the weighted average of the four nearest points to the floating- point index (x, y).

Returns true if the point has any contributors, false if the point is unknown.

Definition at line 688 of file pfmFile.cxx.

References get_point(), and has_point().

Referenced by apply_1d_lut(), forward_distort(), PfmVizzer::project(), PT(), and reverse_distort().

◆ calc_min_max()

bool PfmFile::calc_min_max ( LVecBase3f & min_depth,
LVecBase3f & max_depth ) const

Calculates the minimum and maximum x, y, and z depth component values, representing the bounding box of depth values, and places them in the indicated vectors.

Returns true if successful, false if the mesh contains no points.

Definition at line 736 of file pfmFile.cxx.

References get_point(), and has_point().

◆ calc_tight_bounds()

bool PfmFile::calc_tight_bounds ( LPoint3f & min_point,
LPoint3f & max_point ) const

Calculates the minimum and maximum vertices of all points within the table.

Assumes the table contains 3-D points.

The return value is true if any points in the table, or false if none are.

Definition at line 1645 of file pfmFile.cxx.

References get_point(), and has_point().

◆ clear() [1/2]

void PfmFile::clear ( )

◆ clear() [2/2]

void PfmFile::clear ( int x_size,
int y_size,
int num_channels )

Resets to an empty table with a specific size.

The case of num_channels == 0 is allowed only in the case that x_size and y_size are also == 0; and this makes an empty (and invalid) PfmFile.

Definition at line 91 of file pfmFile.cxx.

References clear_no_data_value().

◆ clear_no_data_value()

void PfmFile::clear_no_data_value ( )
inline

Removes the special value that means "no data" when it appears in the pfm file.

All points will thus be considered valid.

Definition at line 420 of file pfmFile.I.

Referenced by clear(), clear(), set_no_data_chan4(), set_no_data_nan(), and set_zero_special().

◆ clear_to_texcoords()

void PfmFile::clear_to_texcoords ( int x_size,
int y_size )

Replaces this PfmFile with a new PfmFile of size x_size x y_size x 3, containing the x y 0 values in the range 0 .

. 1 according to the x y index.

Definition at line 1581 of file pfmFile.cxx.

References clear(), and set_point().

Referenced by PfmVizzer::generate_vis_mesh().

◆ copy_channel()

void PfmFile::copy_channel ( int to_channel,
const PfmFile & other,
int from_channel )

Copies just the specified channel values from the indicated PfmFile (which could be same as this PfmFile) into the specified channel of this one.

Definition at line 1512 of file pfmFile.cxx.

References get_channel(), PNMImageHeader::get_num_channels, and set_channel().

Referenced by PfmVizzer::generate_vis_mesh().

◆ copy_channel_masked()

void PfmFile::copy_channel_masked ( int to_channel,
const PfmFile & other,
int from_channel )

Copies just the specified channel values from the indicated PfmFile, but only where the other file has a data point.

Definition at line 1530 of file pfmFile.cxx.

References get_channel(), PNMImageHeader::get_num_channels, has_point(), and set_channel().

◆ divide_sub_image()

void PfmFile::divide_sub_image ( const PfmFile & copy,
int xto,
int yto,
int xfrom = 0,
int yfrom = 0,
int x_size = -1,
int y_size = -1,
float pixel_scale = 1.0 )

Behaves like copy_sub_image(), except the copy pixels are divided into the pixels of the destination, after scaling by the specified pixel_scale.

dest(x, y) = dest(x, y) / (copy(x, y) * pixel_scale).

Definition at line 2093 of file pfmFile.cxx.

References get_point1(), get_point2(), get_point3(), get_point4(), has_point(), modify_point2(), modify_point3(), modify_point4(), and set_point1().

◆ fill() [1/4]

void PfmFile::fill ( const LPoint2f & value)
inline

Fills the table with all of the same value.

Definition at line 323 of file pfmFile.I.

References fill().

◆ fill() [2/4]

void PfmFile::fill ( const LPoint3f & value)
inline

Fills the table with all of the same value.

Definition at line 331 of file pfmFile.I.

References fill().

◆ fill() [3/4]

void PfmFile::fill ( const LPoint4f & value)

Fills the table with all of the same value.

Definition at line 482 of file pfmFile.cxx.

◆ fill() [4/4]

void PfmFile::fill ( PN_float32 value)
inline

Fills the table with all of the same value.

Definition at line 315 of file pfmFile.I.

References fill().

Referenced by fill(), fill(), fill(), fill_nan(), fill_no_data_value(), forward_distort(), resize(), and reverse_distort().

◆ fill_channel()

void PfmFile::fill_channel ( int channel,
PN_float32 value )

Fills the indicated channel with all of the same value, leaving the other channels unchanged.

Definition at line 549 of file pfmFile.cxx.

Referenced by fill_channel_masked(), and fill_channel_nan().

◆ fill_channel_masked()

void PfmFile::fill_channel_masked ( int channel,
PN_float32 value )

Fills the indicated channel with all of the same value, but only where the table already has a data point.

Leaves empty points unchanged.

Definition at line 573 of file pfmFile.cxx.

References fill_channel(), and has_point().

Referenced by fill_channel_masked_nan().

◆ fill_channel_masked_nan()

void PfmFile::fill_channel_masked_nan ( int channel)

Fills the indicated channel with NaN, but only where the table already has a data point.

Leaves empty points unchanged.

Definition at line 594 of file pfmFile.cxx.

References fill_channel_masked().

◆ fill_channel_nan()

void PfmFile::fill_channel_nan ( int channel)

Fills the indicated channel with NaN, leaving the other channels unchanged.

Definition at line 563 of file pfmFile.cxx.

References fill_channel().

◆ fill_nan()

void PfmFile::fill_nan ( )

Fills the table with all NaN.

Definition at line 530 of file pfmFile.cxx.

References fill().

◆ fill_no_data_value()

void PfmFile::fill_no_data_value ( )

Fills the table with the current no_data value, so that the table is empty.

Definition at line 540 of file pfmFile.cxx.

References fill().

◆ flip()

void PfmFile::flip ( bool flip_x,
bool flip_y,
bool transpose )

Reverses, transposes, and/or rotates the table in-place according to the specified parameters.

If flip_x is true, the x axis is reversed; if flip_y is true, the y axis is reversed. Then, if transpose is true, the x and y axes are exchanged. These parameters can be used to select any combination of 90-degree or 180-degree rotations and flips.

Definition at line 1173 of file pfmFile.cxx.

Referenced by PfmTrans::process_pfm().

◆ forward_distort()

void PfmFile::forward_distort ( const PfmFile & dist,
PN_float32 scale_factor = 1.0 )

Applies the distortion indicated in the supplied dist map to the current map.

The dist map is understood to be a mapping of points in the range 0..1 in the first two dimensions.

The operation can be expressed symbolically as:

this(u, v) = this(dist(u, v))

If scale_factor is not 1, it should be a value > 1, and it specifies the factor to upscale the working table while processing, to reduce artifacts from integer truncation.

By convention, the y axis is inverted in the distortion map relative to the coordinates here. A y value of 0 in the distortion map corresponds with a v value of 1 in this file.

Definition at line 1304 of file pfmFile.cxx.

References calc_bilinear_point(), clear(), fill(), get_point2(), PNMImageHeader::get_x_size(), PNMImageHeader::get_y_size(), has_point(), resize(), set_no_data_value(), and set_point().

◆ gamma_correct_alpha()

void PfmFile::gamma_correct_alpha ( float from_gamma,
float to_gamma )
inline

Assuming the image was constructed with a gamma curve of from_gamma in the alpha channel, converts it to an image with a gamma curve of to_gamma in the alpha channel.

Does not affect the RGB channels.

Definition at line 498 of file pfmFile.I.

References apply_exponent().

◆ gaussian_filter_from()

void PfmFile::gaussian_filter_from ( float width,
const PfmFile & copy )

Makes a resized copy of the indicated image into this one using the indicated filter.

The image to be copied is squashed and stretched to match the dimensions of the current image, applying the appropriate filter to perform the stretching.

Definition at line 664 of file pnm-image-filter.cxx.

Referenced by resize().

◆ get_channel()

PN_float32 PfmFile::get_channel ( int x,
int y,
int c ) const
inline

Returns the cth channel of the point value at the indicated point.

Definition at line 51 of file pfmFile.I.

Referenced by apply_1d_lut(), copy_channel(), copy_channel_masked(), indirect_1d_lookup(), and PfmTrans::process_pfm().

◆ get_no_data_value()

const LPoint4f & PfmFile::get_no_data_value ( ) const
inline

If has_no_data_value() returns true, this returns the particular "no data" value.

Definition at line 450 of file pfmFile.I.

Referenced by PfmVizzer::project().

◆ get_point()

const LPoint3f & PfmFile::get_point ( int x,
int y ) const
inline

Returns the 3-component point value at the indicated point.

In a 1-channel image, the channel value is in the x component.

Definition at line 157 of file pfmFile.I.

References get_point3().

Referenced by calc_average_point(), calc_bilinear_point(), PfmVizzer::calc_max_u_displacement(), PfmVizzer::calc_max_v_displacement(), calc_min_max(), calc_tight_bounds(), PfmVizzer::extrude(), PfmVizzer::generate_vis_points(), PfmVizzer::make_displacement(), PfmVizzer::make_displacement(), and PT().

◆ get_point1()

PN_float32 PfmFile::get_point1 ( int x,
int y ) const
inline

Returns the 1-component point value at the indicated point.

Definition at line 73 of file pfmFile.I.

Referenced by add_sub_image(), divide_sub_image(), PfmVizzer::extrude(), indirect_1d_lookup(), mult_sub_image(), operator*=(), and xform().

◆ get_point2()

const LPoint2f & PfmFile::get_point2 ( int x,
int y ) const
inline

Returns the 2-component point value at the indicated point.

In a 1-channel image, the channel value is in the x component.

Definition at line 95 of file pfmFile.I.

Referenced by add_sub_image(), divide_sub_image(), forward_distort(), indirect_1d_lookup(), mult_sub_image(), reverse_distort(), store(), and xform().

◆ get_point3()

const LPoint3f & PfmFile::get_point3 ( int x,
int y ) const
inline

Returns the 3-component point value at the indicated point.

In a 1-channel image, the channel value is in the x component.

Definition at line 192 of file pfmFile.I.

Referenced by add_sub_image(), divide_sub_image(), get_point(), indirect_1d_lookup(), mult_sub_image(), and store().

◆ get_point4()

const LPoint4f & PfmFile::get_point4 ( int x,
int y ) const
inline

Returns the 4-component point value at the indicated point.

In a 1-channel image, the channel value is in the x component.

Definition at line 254 of file pfmFile.I.

Referenced by add_sub_image(), divide_sub_image(), indirect_1d_lookup(), mult_sub_image(), and store().

◆ get_table()

const vector_float & PfmFile::get_table ( ) const
inline

This is a very low-level function that returns a read-only reference to the internal table of floating-point numbers.

Use this method at your own risk.

Definition at line 537 of file pfmFile.I.

Referenced by PNMFileTypePfm::Writer::write_pfm().

◆ has_no_data_threshold()

bool PfmFile::has_no_data_threshold ( ) const
inline

Returns whether a "no data" threshold value has been established by set_no_data_threshold().

Definition at line 441 of file pfmFile.I.

◆ has_no_data_value()

bool PfmFile::has_no_data_value ( ) const
inline

Returns whether a "no data" value has been established by set_no_data_value().

Definition at line 432 of file pfmFile.I.

Referenced by PfmVizzer::extrude(), and PfmVizzer::project().

◆ has_point()

bool PfmFile::has_point ( int x,
int y ) const
inline

◆ indirect_1d_lookup()

void PfmFile::indirect_1d_lookup ( const PfmFile & index_image,
int channel,
const PfmFile & pixel_values )

index_image is a WxH 1-channel image, while pixel_values is an Nx1 image with any number of channels.

Typically pixel_values will be a 256x1 image.

Fills the PfmFile with a new image the same width and height as index_image, with the same number of channels as pixel_values.

Each pixel of the new image is computed with the formula:

new_image(x, y) = pixel_values(index_image(x, y)[channel], 0)

At present, no interpolation is performed; the nearest value in pixel_values is discovered. This may change in the future.

Definition at line 2248 of file pfmFile.cxx.

References clear(), get_channel(), PNMImageHeader::get_num_channels, get_point1(), get_point2(), get_point3(), get_point4(), PNMImageHeader::get_x_size(), PNMImageHeader::get_y_size(), set_point1(), set_point2(), set_point3(), and set_point4().

◆ is_column_empty()

bool PfmFile::is_column_empty ( int x,
int y_begin,
int y_end ) const

Returns true if all of the points on column x, from [y_begin, y_end), are the no_data value, or false if any one of these points has a value.

Definition at line 833 of file pfmFile.cxx.

References has_point().

Referenced by calc_autocrop().

◆ is_row_empty()

bool PfmFile::is_row_empty ( int y,
int x_begin,
int x_end ) const

Returns true if all of the points on row y, in the range [x_begin, x_end), are the no_data value, or false if any one of these points has a value.

Definition at line 812 of file pfmFile.cxx.

References has_point().

Referenced by calc_autocrop().

◆ load()

bool PfmFile::load ( const PNMImage & pnmimage)

Fills the PfmFile with the data from the indicated PNMImage, converted to floating-point values.

Definition at line 286 of file pfmFile.cxx.

References clear(), PNMImage::get_alpha(), PNMImage::get_gray(), PNMImageHeader::get_num_channels, PNMImageHeader::get_x_size(), PNMImage::get_xel(), PNMImage::get_xel_a(), PNMImageHeader::get_y_size(), and PNMImage::is_valid().

Referenced by read(), and PNMImage::write().

◆ merge()

void PfmFile::merge ( const PfmFile & other)

Wherever there is missing data in this PfmFile (that is, wherever has_point() returns false), copy data from the other PfmFile, which must be exactly the same dimensions as this one.

Definition at line 1460 of file pfmFile.cxx.

References has_point().

◆ modify_point()

LPoint3f & PfmFile::modify_point ( int x,
int y )
inline

Returns a modifiable 3-component point value at the indicated point.

Definition at line 183 of file pfmFile.I.

References modify_point3().

Referenced by PfmVizzer::project().

◆ modify_point2()

LPoint2f & PfmFile::modify_point2 ( int x,
int y )
inline

Returns a modifiable 2-component point value at the indicated point.

Definition at line 142 of file pfmFile.I.

Referenced by divide_sub_image(), mult_sub_image(), and operator*=().

◆ modify_point3()

LPoint3f & PfmFile::modify_point3 ( int x,
int y )
inline

Returns a modifiable 3-component point value at the indicated point.

Definition at line 239 of file pfmFile.I.

Referenced by divide_sub_image(), modify_point(), mult_sub_image(), operator*=(), and xform().

◆ modify_point4()

LPoint4f & PfmFile::modify_point4 ( int x,
int y )
inline

Returns a modifiable 4-component point value at the indicated point.

Definition at line 301 of file pfmFile.I.

Referenced by divide_sub_image(), mult_sub_image(), operator*=(), and xform().

◆ mult_sub_image()

void PfmFile::mult_sub_image ( const PfmFile & copy,
int xto,
int yto,
int xfrom = 0,
int yfrom = 0,
int x_size = -1,
int y_size = -1,
float pixel_scale = 1.0 )

Behaves like copy_sub_image(), except the copy pixels are multiplied to the pixels of the destination, after scaling by the specified pixel_scale.

Definition at line 2028 of file pfmFile.cxx.

References get_point1(), get_point2(), get_point3(), get_point4(), has_point(), modify_point2(), modify_point3(), modify_point4(), and set_point1().

◆ operator*=()

void PfmFile::operator*= ( float multiplier)

Multiplies every point value in the image by a constant floating-point multiplier value.

Definition at line 2173 of file pfmFile.cxx.

References get_point1(), has_point(), modify_point2(), modify_point3(), modify_point4(), and set_point1().

◆ operator=()

void PfmFile::operator= ( const PfmFile & copy)

Definition at line 62 of file pfmFile.cxx.

◆ output()

void PfmFile::output ( std::ostream & out) const

Definition at line 2354 of file pfmFile.cxx.

◆ pull_spot()

int PfmFile::pull_spot ( const LPoint4f & delta,
float xc,
float yc,
float xr,
float yr,
float exponent )

Applies delta * t to the point values within radius (xr, yr) distance of (xc, yc).

The t value is scaled from 1.0 at the center to 0.0 at radius (xr, yr), and this scale follows the specified exponent. Returns the number of points affected.

Definition at line 1609 of file pfmFile.cxx.

◆ quick_filter_from()

void PfmFile::quick_filter_from ( const PfmFile & from)

Resizes from the given image, with a fixed radius of 0.5.

This is a very specialized and simple algorithm that doesn't handle dropping below the Nyquist rate very well, but is quite a bit faster than the more general box_filter(), above.

Definition at line 997 of file pfmFile.cxx.

References PNMImageHeader::get_x_size(), and PNMImageHeader::get_y_size().

Referenced by resize().

◆ read() [1/3]

bool PfmFile::read ( const Filename & fullpath)

Reads the PFM data from the indicated file, returning true on success, false on failure.

This can also handle reading a standard image file supported by PNMImage; it will be quietly converted to a floating-point type.

Definition at line 120 of file pfmFile.cxx.

References VirtualFileSystem::close_read_file(), VirtualFileSystem::get_file(), VirtualFileSystem::get_global_ptr(), and read().

Referenced by read(), and read().

◆ read() [2/3]

bool PfmFile::read ( PNMReader * reader)

Reads the PFM data using the indicated PNMReader.

The PNMReader is always deleted upon completion, whether successful or not.

Definition at line 167 of file pfmFile.cxx.

References clear(), PNMReader::is_floating_point(), PNMReader::is_valid(), load(), PNMImage::read(), and PNMReader::read_pfm().

◆ read() [3/3]

bool PfmFile::read ( std::istream & in,
const Filename & fullpath = Filename() )

Reads the PFM data from the indicated stream, returning true on success, false on failure.

This can also handle reading a standard image file supported by PNMImage; it will be quietly converted to a floating-point type.

Definition at line 152 of file pfmFile.cxx.

References clear(), PNMImageHeader::make_reader(), and read().

◆ resize()

void PfmFile::resize ( int new_x_size,
int new_y_size )

Applies a simple filter to resample the pfm file in-place to the indicated size.

Don't confuse this with applying a scale to all of the points via xform().

Definition at line 955 of file pfmFile.cxx.

References box_filter_from(), clear(), fill(), gaussian_filter_from(), and quick_filter_from().

Referenced by forward_distort(), PfmTrans::process_pfm(), and reverse_distort().

◆ reverse_distort()

void PfmFile::reverse_distort ( const PfmFile & dist,
PN_float32 scale_factor = 1.0 )

Applies the distortion indicated in the supplied dist map to the current map.

The dist map is understood to be a mapping of points in the range 0..1 in the first two dimensions.

The operation can be expressed symbolically as:

this(u, v) = dist(this(u, v))

If scale_factor is not 1, it should be a value > 1, and it specifies the factor to upscale the working table while processing, to reduce artifacts from integer truncation.

By convention, the y axis in inverted in the distortion map relative to the coordinates here. A y value of 0 in the distortion map corresponds with a v value of 1 in this file.

Definition at line 1377 of file pfmFile.cxx.

References calc_bilinear_point(), clear(), fill(), get_point2(), PNMImageHeader::get_x_size(), PNMImageHeader::get_y_size(), has_point(), resize(), set_no_data_value(), and set_point().

◆ reverse_rows()

void PfmFile::reverse_rows ( )

Performs an in-place reversal of the row (y) data.

Definition at line 1145 of file pfmFile.cxx.

◆ set_channel()

void PfmFile::set_channel ( int x,
int y,
int c,
PN_float32 value )
inline

Replaces the cth channel of the point value at the indicated point.

Definition at line 62 of file pfmFile.I.

Referenced by apply_1d_lut(), copy_channel(), copy_channel_masked(), and PfmVizzer::make_displacement().

◆ set_no_data_chan4()

void PfmFile::set_no_data_chan4 ( bool chan4)
inline

Sets the no_data_chan4 flag.

When this flag is true, and the pfm file has 4 channels, then a negative value in the fourth channel indicates no data. When it is false, all points are valid.

This is a special case of set_no_data_value().

Definition at line 386 of file pfmFile.I.

References clear_no_data_value().

◆ set_no_data_nan()

void PfmFile::set_no_data_nan ( int num_channels)

Sets the no_data_nan flag.

When num_channels is nonzero, then a NaN value in any of the first num_channels channels indicates no data for that point. If num_channels is zero, then all points are valid.

This is a special case of set_no_data_value().

Definition at line 857 of file pfmFile.cxx.

References clear_no_data_value().

Referenced by PfmTrans::process_pfm().

◆ set_no_data_threshold() [1/2]

void PfmFile::set_no_data_threshold ( const LPoint4d & no_data_threshold)
inline

Sets the special threshold value.

Points that are below this value in all components are considered "no value".

Definition at line 411 of file pfmFile.I.

References set_no_data_threshold().

◆ set_no_data_threshold() [2/2]

void PfmFile::set_no_data_threshold ( const LPoint4f & no_data_value)

Sets the special threshold value.

Points that are below this value in all components are considered "no value".

Definition at line 924 of file pfmFile.cxx.

Referenced by set_no_data_threshold().

◆ set_no_data_value() [1/2]

void PfmFile::set_no_data_value ( const LPoint4d & no_data_value)
inline

Sets the special value that means "no data" when it appears in the pfm file.

Definition at line 402 of file pfmFile.I.

References set_no_data_value().

◆ set_no_data_value() [2/2]

void PfmFile::set_no_data_value ( const LPoint4f & no_data_value)

Sets the special value that means "no data" when it appears in the pfm file.

Definition at line 894 of file pfmFile.cxx.

Referenced by forward_distort(), reverse_distort(), set_no_data_value(), and set_zero_special().

◆ set_point() [1/2]

void PfmFile::set_point ( int x,
int y,
const LVecBase3d & point )
inline

Replaces the 3-component point value at the indicated point.

In a 1-channel image, the channel value is in the x component.

Definition at line 175 of file pfmFile.I.

References set_point3().

◆ set_point() [2/2]

void PfmFile::set_point ( int x,
int y,
const LVecBase3f & point )
inline

Replaces the 3-component point value at the indicated point.

In a 1-channel image, the channel value is in the x component.

Definition at line 166 of file pfmFile.I.

References set_point3().

Referenced by clear_to_texcoords(), PfmVizzer::extrude(), forward_distort(), and reverse_distort().

◆ set_point1()

void PfmFile::set_point1 ( int x,
int y,
PN_float32 point )
inline

Replaces the 1-component point value at the indicated point.

Definition at line 83 of file pfmFile.I.

Referenced by add_sub_image(), divide_sub_image(), indirect_1d_lookup(), mult_sub_image(), operator*=(), and xform().

◆ set_point2() [1/2]

void PfmFile::set_point2 ( int x,
int y,
const LVecBase2d & point )
inline

Replaces the 2-component point value at the indicated point.

In a 1-channel image, the channel value is in the x component.

Definition at line 134 of file pfmFile.I.

References set_point2().

◆ set_point2() [2/2]

void PfmFile::set_point2 ( int x,
int y,
const LVecBase2f & point )
inline

Replaces the 2-component point value at the indicated point.

In a 1-channel image, the channel value is in the x component.

Definition at line 106 of file pfmFile.I.

Referenced by add_sub_image(), indirect_1d_lookup(), set_point2(), and xform().

◆ set_point3() [1/2]

void PfmFile::set_point3 ( int x,
int y,
const LVecBase3d & point )
inline

Replaces the 3-component point value at the indicated point.

In a 1-channel image, the channel value is in the x component.

Definition at line 231 of file pfmFile.I.

References set_point3().

◆ set_point3() [2/2]

void PfmFile::set_point3 ( int x,
int y,
const LVecBase3f & point )
inline

Replaces the 3-component point value at the indicated point.

In a 1-channel image, the channel value is in the x component.

Definition at line 203 of file pfmFile.I.

Referenced by add_sub_image(), indirect_1d_lookup(), PfmVizzer::make_displacement(), set_point(), set_point(), and set_point3().

◆ set_point4() [1/2]

void PfmFile::set_point4 ( int x,
int y,
const LVecBase4d & point )
inline

Replaces the 4-component point value at the indicated point.

In a 1-channel image, the channel value is in the x component.

Definition at line 293 of file pfmFile.I.

References set_point4().

◆ set_point4() [2/2]

void PfmFile::set_point4 ( int x,
int y,
const LVecBase4f & point )
inline

Replaces the 4-component point value at the indicated point.

In a 1-channel image, the channel value is in the x component.

Definition at line 265 of file pfmFile.I.

Referenced by add_sub_image(), apply_mask(), indirect_1d_lookup(), PfmVizzer::project(), and set_point4().

◆ set_zero_special()

void PfmFile::set_zero_special ( bool zero_special)
inline

Sets the zero_special flag.

When this flag is true, values of (0, 0, 0) in the pfm file are treated as a special case, and are not processed.

This is a special case of set_no_data_value().

Definition at line 370 of file pfmFile.I.

References clear_no_data_value(), and set_no_data_value().

Referenced by PfmVizzer::extrude(), PfmBba::process_pfm(), and PfmTrans::process_pfm().

◆ store()

bool PfmFile::store ( PNMImage & pnmimage) const

◆ store_mask() [1/2]

bool PfmFile::store_mask ( PNMImage & pnmimage) const

Stores 1 or 0 values into the indicated PNMImage, according to has_point() for each pixel.

Each valid point gets a 1 value; each nonexistent point gets a 0 value.

Definition at line 425 of file pfmFile.cxx.

References PNMImage::clear(), PNMImageHeader::get_x_size(), PNMImageHeader::get_y_size(), has_point(), and PNMImage::set_gray().

◆ store_mask() [2/2]

bool PfmFile::store_mask ( PNMImage & pnmimage,
const LVecBase4f & min_point,
const LVecBase4f & max_point ) const

Stores 1 or 0 values into the indicated PNMImage, according to has_point() for each pixel.

Each valid point gets a 1 value; each nonexistent point gets a 0 value.

This flavor of store_mask also checks whether the valid points are within the specified min/max range. Any valid points without the condition min_point[c] <= value[c] <= max_point[c], for any c, are stored with a 0 in the mask.

Definition at line 451 of file pfmFile.cxx.

References PNMImage::clear(), PNMImageHeader::get_x_size(), PNMImageHeader::get_y_size(), has_point(), and PNMImage::set_gray().

◆ swap_table()

void PfmFile::swap_table ( vector_float & table)
inline

This is a very low-level function that completely exchanges the PfmFile's internal table of floating-point numbers with whatever you supply.

The provided table must have an appropriate size. Use this method at your own risk.

Definition at line 548 of file pfmFile.I.

Referenced by PNMFileTypePfm::Reader::read_pfm().

◆ write() [1/3]

bool PfmFile::write ( const Filename & fullpath)

Writes the PFM data to the indicated file, returning true on success, false on failure.

If the type implied by the filename extension supports floating-point, the data will be written directly; otherwise, the floating-point data will be quietly converted to the appropriate integer type.

Definition at line 203 of file pfmFile.cxx.

References Filename::open_write(), and write().

Referenced by PfmTrans::process_pfm(), write(), and write().

◆ write() [2/3]

bool PfmFile::write ( PNMWriter * writer)

Writes the PFM data using the indicated PNMWriter.

The PNMWriter is always deleted upon completion, whether successful or not.

Definition at line 250 of file pfmFile.cxx.

References PNMWriter::copy_header_from(), PNMImage::get_alpha_array(), PNMImage::get_array(), store(), PNMWriter::supports_floating_point(), PNMWriter::write_data(), and PNMWriter::write_pfm().

◆ write() [3/3]

bool PfmFile::write ( std::ostream & out,
const Filename & fullpath = Filename() )

Writes the PFM data to the indicated stream, returning true on success, false on failure.

Definition at line 231 of file pfmFile.cxx.

References PNMImageHeader::make_writer(), and write().

◆ xform() [1/2]

void PfmFile::xform ( const LMatrix4d & transform)
inline

Applies the indicated transform matrix to all points in-place.

Definition at line 459 of file pfmFile.I.

References xform().

◆ xform() [2/2]

void PfmFile::xform ( const LMatrix4f & transform)

Applies the indicated transform matrix to all points in-place.

Definition at line 1221 of file pfmFile.cxx.

References PNMImageHeader::get_num_channels, get_point1(), get_point2(), has_point(), modify_point3(), modify_point4(), set_point1(), and set_point2().

Referenced by PfmTrans::process_pfm(), and xform().

Friends And Related Symbol Documentation

◆ PfmVizzer

friend class PfmVizzer
friend

Definition at line 251 of file pfmFile.h.

Member Data Documentation

◆ const

PN_float32 PN_float32 bool points_only PfmFile::const

Definition at line 138 of file pfmFile.h.

◆ get_scale

PN_float32 PfmFile::get_scale
inline

The "scale" is reported in the pfm header and is probably meaningless.

Definition at line 57 of file pfmFile.h.

Referenced by PNMFileTypePfm::Writer::write_pfm().

◆ is_valid

bool PfmFile::is_valid
inline

Definition at line 53 of file pfmFile.h.

◆ point_dist

PN_float32 PfmFile::point_dist

Definition at line 138 of file pfmFile.h.

◆ sample_radius

PN_float32 PN_float32 PfmFile::sample_radius

Definition at line 138 of file pfmFile.h.

◆ set_scale

void PfmFile::set_scale
inline

The "scale" is reported in the pfm header and is probably meaningless.

Definition at line 57 of file pfmFile.h.

Referenced by PNMFileTypePfm::Reader::read_pfm().


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