Functions
contrib/mul/mfpf/mfpf_region_definer.cxx File Reference

Base for objects which generate regions from sets of points. More...

#include "mfpf_region_definer.h"
#include <vsl/vsl_indent.h>
#include <vsl/vsl_binary_loader.h>
#include <mbl/mbl_parse_block.h>
#include <mbl/mbl_read_props.h>
#include <mbl/mbl_cloneables_factory.h>
#include <vcl_sstream.h>

Go to the source code of this file.

Functions

void vsl_add_to_binary_loader (const mfpf_region_definer &b)
 Allows derived class to be loaded by base-class pointer.
void vsl_b_write (vsl_b_ostream &bfs, const mfpf_region_definer &b)
 Binary file stream output operator for class reference.
void vsl_b_read (vsl_b_istream &bfs, mfpf_region_definer &b)
 Binary file stream input operator for class reference.
vcl_ostream & operator<< (vcl_ostream &os, const mfpf_region_definer &b)
 Stream output operator for class reference.
vcl_ostream & operator<< (vcl_ostream &os, const mfpf_region_definer *b)
 Stream output operator for class pointer.
void mfpf_points_from_definers (const vcl_vector< mfpf_region_definer * > &definer, const vcl_vector< vgl_point_2d< double > > &pts0, vcl_vector< vgl_point_2d< double > > &new_pts)
 Generate a new set of points from pts0 using set of definers.
bool mfpf_renumber_to_self (vcl_vector< mfpf_region_definer * > &definer, unsigned n_pts0)
 Change indices in definers to refer to points generated.

Detailed Description

Base for objects which generate regions from sets of points.

Author:
Tim Cootes

Definition in file mfpf_region_definer.cxx.


Function Documentation

void mfpf_points_from_definers ( const vcl_vector< mfpf_region_definer * > &  definer,
const vcl_vector< vgl_point_2d< double > > &  pts0,
vcl_vector< vgl_point_2d< double > > &  new_pts 
)

Generate a new set of points from pts0 using set of definers.

Generate a new set of points from pts0 using set of definers.

Definition at line 134 of file mfpf_region_definer.cxx.

bool mfpf_renumber_to_self ( vcl_vector< mfpf_region_definer * > &  definer,
unsigned  n_pts0 
)

Change indices in definers to refer to points generated.

Suppose definer is used to generate a set of n=definer.size() regions/pts (say pts1), by referring to some other set of m points. This sets up self_definer to generate an identical set of regions/pts by using the originally generated points (pts1). This can only be done if there is a region centred on each of the original points used in the definer. The function tests for this case, and returns false if it fails. In particular consider the following

    vcl_vector<vgl_point_2d<double> > pts0,pts1,pts2;
    // Set up pts0
    ...
    // Generate pts1 from pts0
    mfpf_points_from_definers(definer,pts0,pts1);
    mfpf_renumber_to_self(definer,pts0.size())
    // Now generate pts2 from pts1
    mfpf_points_from_definers(self_definer,pts1,pts2);
    // pts2 should be the same as pts1
    

Note that objects pointed to by definer are changed. They may be left in an invalid state if this returns false, so caller should ensure a backup retained.

Definition at line 168 of file mfpf_region_definer.cxx.

vcl_ostream& operator<< ( vcl_ostream &  os,
const mfpf_region_definer b 
)

Stream output operator for class reference.

Definition at line 112 of file mfpf_region_definer.cxx.

vcl_ostream& operator<< ( vcl_ostream &  os,
const mfpf_region_definer b 
)

Stream output operator for class pointer.

Definition at line 125 of file mfpf_region_definer.cxx.

void vsl_add_to_binary_loader ( const mfpf_region_definer b)

Allows derived class to be loaded by base-class pointer.

Definition at line 85 of file mfpf_region_definer.cxx.

void vsl_b_read ( vsl_b_istream bfs,
mfpf_region_definer b 
)

Binary file stream input operator for class reference.

Definition at line 103 of file mfpf_region_definer.cxx.

void vsl_b_write ( vsl_b_ostream bfs,
const mfpf_region_definer b 
)

Binary file stream output operator for class reference.

Definition at line 94 of file mfpf_region_definer.cxx.