Functions
contrib/mul/mbl/mbl_mask.cxx File Reference

Class representing a binary mask, and related functions. More...

#include "mbl_mask.h"
#include <vcl_set.h>
#include <vcl_map.h>
#include <vcl_fstream.h>
#include <vcl_string.h>
#include <vul/vul_string.h>
#include <mbl/mbl_exception.h>

Go to the source code of this file.

Functions

void mbl_masks_from_index_set (const vcl_vector< unsigned > &indices, vcl_vector< mbl_mask > &masks)
 Given a collection of indices, produce a collection of masks that isolate each indexed set.
void mbl_mask_on_mask (const mbl_mask &A, mbl_mask &B)
 Replace 'true' values in B with values taken from A. size of A must match 'true' count in B.
void mbl_mask_logic_and (const mbl_mask &A, mbl_mask &B)
 Apply an "AND" (rule 0001) logical operation between two masks.
void mbl_mask_logic_or (const mbl_mask &A, mbl_mask &B)
 Apply an "OR" (rule 0111) logical operation between two masks.
void mbl_mask_logic_xor (const mbl_mask &A, mbl_mask &B)
 Apply an "XOR" (rule 0110) logical operation between two masks.
void mbl_mask_logic_nor (const mbl_mask &A, mbl_mask &B)
 Apply a "NOR" (rule 1000) logical operation between two masks.
void mbl_mask_logic_xnor (const mbl_mask &A, mbl_mask &B)
 Apply an "XNOR" (rule 1001) logical operation between two masks.
void mbl_mask_logic_nand (const mbl_mask &A, mbl_mask &B)
 Apply an "NAND" (rule 1110) logical operation between two masks.
void mbl_mask_logic (const mbl_mask &A, mbl_mask &B, const vcl_string &operation)
 Apply a general logical operation between two masks.
void mbl_save_mask (const mbl_mask &mask, vcl_ostream &stream)
 Save to file.
void mbl_save_mask (const mbl_mask &mask, const char *filename)
 Save to file.
void mbl_save_mask (const mbl_mask &mask, const vcl_string &filename)
 Save to file.
void mbl_load_mask (mbl_mask &mask, vcl_istream &stream)
 Load from file.
void mbl_load_mask (mbl_mask &mask, const char *filename)
 Load from file.
void mbl_load_mask (mbl_mask &mask, const vcl_string &filename)
 Load from file.
void mbl_mask_to_indices (const mbl_mask &mask, vcl_vector< unsigned > &inds)
 Convert a mask to a list of indices.
void mbl_indices_to_mask (const vcl_vector< unsigned > &inds, const unsigned n, mbl_mask &mask)
 Convert a list of indices to a mask.

Detailed Description

Class representing a binary mask, and related functions.

Author:
Barry Skellern

Definition in file mbl_mask.cxx.


Function Documentation

void mbl_indices_to_mask ( const vcl_vector< unsigned > &  inds,
const unsigned  n,
mbl_mask mask 
)

Convert a list of indices to a mask.

Parameters:
indsList of (zero-based) indices.
nThe length of the output mask.
Return values:
maskOutput mask. mask[i]==true for all i in inds

Definition at line 205 of file mbl_mask.cxx.

void mbl_load_mask ( mbl_mask mask,
vcl_istream &  stream 
)

Load from file.

Definition at line 150 of file mbl_mask.cxx.

void mbl_load_mask ( mbl_mask mask,
const char *  filename 
)

Load from file.

Definition at line 171 of file mbl_mask.cxx.

void mbl_load_mask ( mbl_mask mask,
const vcl_string &  filename 
)

Load from file.

Definition at line 187 of file mbl_mask.cxx.

void mbl_mask_logic ( const mbl_mask A,
mbl_mask B,
const vcl_string &  operation 
)

Apply a general logical operation between two masks.

Definition at line 99 of file mbl_mask.cxx.

void mbl_mask_logic_and ( const mbl_mask A,
mbl_mask B 
)

Apply an "AND" (rule 0001) logical operation between two masks.

Definition at line 62 of file mbl_mask.cxx.

void mbl_mask_logic_nand ( const mbl_mask A,
mbl_mask B 
)

Apply an "NAND" (rule 1110) logical operation between two masks.

Definition at line 92 of file mbl_mask.cxx.

void mbl_mask_logic_nor ( const mbl_mask A,
mbl_mask B 
)

Apply a "NOR" (rule 1000) logical operation between two masks.

Definition at line 80 of file mbl_mask.cxx.

void mbl_mask_logic_or ( const mbl_mask A,
mbl_mask B 
)

Apply an "OR" (rule 0111) logical operation between two masks.

Definition at line 68 of file mbl_mask.cxx.

void mbl_mask_logic_xnor ( const mbl_mask A,
mbl_mask B 
)

Apply an "XNOR" (rule 1001) logical operation between two masks.

Definition at line 86 of file mbl_mask.cxx.

void mbl_mask_logic_xor ( const mbl_mask A,
mbl_mask B 
)

Apply an "XOR" (rule 0110) logical operation between two masks.

Definition at line 74 of file mbl_mask.cxx.

void mbl_mask_on_mask ( const mbl_mask A,
mbl_mask B 
)

Replace 'true' values in B with values taken from A. size of A must match 'true' count in B.

Definition at line 48 of file mbl_mask.cxx.

void mbl_mask_to_indices ( const mbl_mask mask,
vcl_vector< unsigned > &  inds 
)

Convert a mask to a list of indices.

Parameters:
maskInput mask.
Return values:
indsList of (zero-based) indices i where mask[i]==true.

Definition at line 194 of file mbl_mask.cxx.

void mbl_masks_from_index_set ( const vcl_vector< unsigned > &  indices,
vcl_vector< mbl_mask > &  masks 
)

Given a collection of indices, produce a collection of masks that isolate each indexed set.

The input index set does not need to be zero based or continuous The output vector of masks is sorted such that for example: (1,4,2,1,2) will make three masks: (1,0,0,1,0), (0,0,1,0,1) and (0,1,0,0,0) which correspond to the sorted index sets 1,2,4

Definition at line 23 of file mbl_mask.cxx.

void mbl_save_mask ( const mbl_mask mask,
vcl_ostream &  stream 
)

Save to file.

Definition at line 123 of file mbl_mask.cxx.

void mbl_save_mask ( const mbl_mask mask,
const char *  filename 
)

Save to file.

Definition at line 132 of file mbl_mask.cxx.

void mbl_save_mask ( const mbl_mask mask,
const vcl_string &  filename 
)

Save to file.

Definition at line 141 of file mbl_mask.cxx.