libatomprobe
Library for Atom Probe Tomography (APT) computation
Public Member Functions | List of all members
AtomProbe::MultiRange Class Reference

Data storage and retrieval class for "ranging" a spectra, where overlapping ranges are permitted. More...

#include <multiRange.h>

Public Member Functions

 MultiRange ()
 
 MultiRange (const AtomProbe::RangeFile &rng, const AtomProbe::AbundanceData &natData)
 Do our best to initialise from a rangefile. More...
 
bool operator== (const MultiRange &oth) const
 Check for equality with other multirange. More...
 
unsigned int addIon (const std::set< SIMPLE_SPECIES > &molecule, const std::string &name, const RGBf &ionCol)
 Add the ion to the database returns ion ID if successful, -1 otherwise. More...
 
unsigned int addIon (const SIMPLE_SPECIES &molecule, const std::string &name, const RGBf &ionCol)
 Add a simple ion to the database - returns ion ID if successful, -1 otherwise. More...
 
unsigned int addRange (float start, float end, unsigned int ionID)
 Add a range to the rangefile. Returns ID number of added range if adding successful, (unsigned int)-1 otherwise. More...
 
unsigned int addRange (const std::pair< float, float > &rng, unsigned int ionID)
 Convenience wrapper for addRange(float,float, unsigned int) More...
 
void setRangeGroups (const std::vector< unsigned int > &groups)
 Set the groupings for the ranges : this is used when splitting overlapping ranges. More...
 
bool write (const char *fileName, unsigned int format=MULTIRANGE_FORMAT_XML) const
 Save the structure to a file. format specifies output file format type. More...
 
bool open (const char *fileName, unsigned int format=-1)
 read the contents of the file into class More...
 
unsigned int getIonID (unsigned int rangeId) const
 Get the ion's ID from a specified mass. More...
 
void setIonID (unsigned int range, unsigned int newIonId)
 Set the ion ID for a given range. More...
 
RGBf getColour (unsigned int ionID) const
 Obtain the colour for a given ion. More...
 
void setColour (unsigned int ionID, const RGBf &r)
 Set the colour using the ion ID. More...
 
std::string getErrString () const
 Retrieve the human-readable error associated with the current range file state. More...
 
std::string getIonName (unsigned int ionID) const
 Get the name of a specified ionID. More...
 
unsigned int getNumRanges () const
 Get the number of unique ranges. More...
 
unsigned int getNumRanges (unsigned int ionID) const
 Get the number of ranges for a given ion ID. More...
 
unsigned int getNumIons () const
 Get the number of unique ions. More...
 
std::set< SIMPLE_SPECIESgetMolecule (unsigned int ionID) const
 Return the molecule that is associated with this ion. More...
 
std::pair< float, float > getRange (unsigned int rangeID) const
 Retrieve the start and end of a given range as a pair(start,end) More...
 
std::vector< unsigned int > getRanges (float mass) const
 Retrieve all of the ranges that specify the given mass. More...
 
bool isRanged (float mass) const
 Returns true if a specified mass is ranged. More...
 
bool isRanged (const IonHit &) const
 Returns true if an ion is ranged. More...
 
void range (std::vector< IonHit > &ionHits) const
 Clips out ions that are not inside the rangefile's ranges. More...
 
bool isSelfConsistent () const
 Check to see if data structure is internally consistent. More...
 
void clear ()
 Erase the contents of the rangefile. More...
 
void flattenToMassAxis (std::vector< FLATTENED_RANGE > &ionMapping, float tolerance=0) const
 Obtain a projection onto the mass axis of ranges that do not touch one another. More...
 
void splitOverlapping (std::vector< MultiRange > &decomposedRanges, float massTolerance=0) const
 
void copyDataFromRange (const MultiRange &src, unsigned int srcRngId)
 Copy range from a different multirange into this one, including all dependant data. More...
 

Detailed Description

Data storage and retrieval class for "ranging" a spectra, where overlapping ranges are permitted.

Definition at line 63 of file multiRange.h.

Constructor & Destructor Documentation

◆ MultiRange() [1/2]

AtomProbe::MultiRange::MultiRange ( )

Definition at line 136 of file multiRange.cpp.

◆ MultiRange() [2/2]

AtomProbe::MultiRange::MultiRange ( const AtomProbe::RangeFile rng,
const AtomProbe::AbundanceData natData 
)

Member Function Documentation

◆ addIon() [1/2]

unsigned int AtomProbe::MultiRange::addIon ( const std::set< SIMPLE_SPECIES > &  molecule,
const std::string &  name,
const RGBf ionCol 
)

Add the ion to the database returns ion ID if successful, -1 otherwise.

Definition at line 271 of file multiRange.cpp.

References ASSERT, and isSelfConsistent().

Referenced by addIon(), AtomProbe::computeRangeAdjacency(), copyDataFromRange(), and AtomProbe::leastSquaresOverlapSolve().

Here is the call graph for this function:

◆ addIon() [2/2]

unsigned int AtomProbe::MultiRange::addIon ( const SIMPLE_SPECIES molecule,
const std::string &  name,
const RGBf ionCol 
)

Add a simple ion to the database - returns ion ID if successful, -1 otherwise.

Definition at line 293 of file multiRange.cpp.

References addIon(), ASSERT, and isSelfConsistent().

Here is the call graph for this function:

◆ addRange() [1/2]

unsigned int AtomProbe::MultiRange::addRange ( float  start,
float  end,
unsigned int  ionID 
)

Add a range to the rangefile. Returns ID number of added range if adding successful, (unsigned int)-1 otherwise.

Note that ranges are, unlike RangeFile, allowed to overlap, and still be self consistent.

Definition at line 303 of file multiRange.cpp.

References ASSERT, and isSelfConsistent().

Referenced by AtomProbe::computeRangeAdjacency(), copyDataFromRange(), and AtomProbe::leastSquaresOverlapSolve().

Here is the call graph for this function:

◆ addRange() [2/2]

unsigned int AtomProbe::MultiRange::addRange ( const std::pair< float, float > &  rng,
unsigned int  ionID 
)

Convenience wrapper for addRange(float,float, unsigned int)

◆ clear()

void AtomProbe::MultiRange::clear ( )

Erase the contents of the rangefile.

Definition at line 831 of file multiRange.cpp.

Referenced by open().

◆ copyDataFromRange()

void AtomProbe::MultiRange::copyDataFromRange ( const MultiRange src,
unsigned int  srcRngId 
)

◆ flattenToMassAxis()

void AtomProbe::MultiRange::flattenToMassAxis ( std::vector< FLATTENED_RANGE > &  ionMapping,
float  tolerance = 0 
) const

Obtain a projection onto the mass axis of ranges that do not touch one another.

Definition at line 915 of file multiRange.cpp.

References ASSERT, and AtomProbe::FLATTENED_RANGE::startMass.

Referenced by splitOverlapping().

◆ getColour()

RGBf AtomProbe::MultiRange::getColour ( unsigned int  ionID) const

Obtain the colour for a given ion.

Definition at line 785 of file multiRange.cpp.

References ASSERT.

◆ getErrString()

std::string AtomProbe::MultiRange::getErrString ( ) const

Retrieve the human-readable error associated with the current range file state.

Definition at line 693 of file multiRange.cpp.

References ASSERT, and AtomProbe::MULTIRANGE_ERR_ENUM_END.

◆ getIonID()

unsigned int AtomProbe::MultiRange::getIonID ( unsigned int  rangeId) const

Get the ion's ID from a specified mass.

Returns the ions ID if there exists a range that contains this mass. Otherwise (unsigned int)-1 is returned

Definition at line 752 of file multiRange.cpp.

References ASSERT, and range().

Here is the call graph for this function:

◆ getIonName()

std::string AtomProbe::MultiRange::getIonName ( unsigned int  ionID) const

Get the name of a specified ionID.

Definition at line 733 of file multiRange.cpp.

References ASSERT.

Referenced by copyDataFromRange(), and AtomProbe::leastSquaresOverlapSolve().

◆ getMolecule()

set< SIMPLE_SPECIES > AtomProbe::MultiRange::getMolecule ( unsigned int  ionID) const

Return the molecule that is associated with this ion.

Definition at line 727 of file multiRange.cpp.

References ASSERT.

Referenced by AtomProbe::computeIonDistAdjacency().

◆ getNumIons()

unsigned int AtomProbe::MultiRange::getNumIons ( ) const

Get the number of unique ions.

Definition at line 747 of file multiRange.cpp.

Referenced by AtomProbe::computeIonDistAdjacency(), copyDataFromRange(), and AtomProbe::leastSquaresOverlapSolve().

◆ getNumRanges() [1/2]

unsigned int AtomProbe::MultiRange::getNumRanges ( ) const

Get the number of unique ranges.

Definition at line 720 of file multiRange.cpp.

Referenced by AtomProbe::computeRangeAdjacency(), copyDataFromRange(), and AtomProbe::leastSquaresOverlapSolve().

◆ getNumRanges() [2/2]

unsigned int AtomProbe::MultiRange::getNumRanges ( unsigned int  ionID) const

Get the number of ranges for a given ion ID.

Definition at line 739 of file multiRange.cpp.

References ASSERT.

◆ getRange()

std::pair< float, float > AtomProbe::MultiRange::getRange ( unsigned int  rangeID) const

Retrieve the start and end of a given range as a pair(start,end)

Definition at line 759 of file multiRange.cpp.

References ASSERT.

Referenced by AtomProbe::computeRangeAdjacency().

◆ getRanges()

std::vector< unsigned int > AtomProbe::MultiRange::getRanges ( float  mass) const

Retrieve all of the ranges that specify the given mass.

Definition at line 765 of file multiRange.cpp.

◆ isRanged() [1/2]

bool AtomProbe::MultiRange::isRanged ( float  mass) const

Returns true if a specified mass is ranged.

Definition at line 797 of file multiRange.cpp.

References range().

Referenced by isRanged(), and range().

Here is the call graph for this function:

◆ isRanged() [2/2]

bool AtomProbe::MultiRange::isRanged ( const IonHit ion) const

Returns true if an ion is ranged.

Definition at line 809 of file multiRange.cpp.

References AtomProbe::IonHit::getMassToCharge(), and isRanged().

Here is the call graph for this function:

◆ isSelfConsistent()

bool AtomProbe::MultiRange::isSelfConsistent ( ) const

Check to see if data structure is internally consistent.

Definition at line 230 of file multiRange.cpp.

Referenced by addIon(), addRange(), copyDataFromRange(), MultiRange(), open(), and write().

◆ open()

bool AtomProbe::MultiRange::open ( const char *  fileName,
unsigned int  format = -1 
)

◆ operator==()

bool AtomProbe::MultiRange::operator== ( const MultiRange oth) const

Check for equality with other multirange.

Definition at line 208 of file multiRange.cpp.

◆ range()

void AtomProbe::MultiRange::range ( std::vector< IonHit > &  ionHits) const

Clips out ions that are not inside the rangefile's ranges.

Definition at line 814 of file multiRange.cpp.

References isRanged().

Referenced by getIonID(), isRanged(), and setIonID().

Here is the call graph for this function:

◆ setColour()

void AtomProbe::MultiRange::setColour ( unsigned int  ionID,
const RGBf r 
)

Set the colour using the ion ID.

Definition at line 791 of file multiRange.cpp.

References ASSERT.

◆ setIonID()

void AtomProbe::MultiRange::setIonID ( unsigned int  range,
unsigned int  newIonId 
)

Set the ion ID for a given range.

Definition at line 778 of file multiRange.cpp.

References ASSERT, and range().

Here is the call graph for this function:

◆ setRangeGroups()

void AtomProbe::MultiRange::setRangeGroups ( const std::vector< unsigned int > &  groups)

Set the groupings for the ranges : this is used when splitting overlapping ranges.

When splitting overlapping ranges, "grouped" ranges are considered to be part of the same split grouping. This is typically used for example, to group isotopes that belong to an ion, but of differing charge state. As the intensities for charge state in an experiment are not linked There is no need to link these in the range group. Each range with a shared integer belongs to the same group

  • the input vector must match range size, or be empty.
  • range size cannot be changed without changing grouping vector

Definition at line 321 of file multiRange.cpp.

References ASSERT.

Referenced by copyDataFromRange(), and AtomProbe::leastSquaresOverlapSolve().

◆ splitOverlapping()

void AtomProbe::MultiRange::splitOverlapping ( std::vector< MultiRange > &  decomposedRanges,
float  massTolerance = 0 
) const

Separate out the non-interacting parts of the multi-ranges into their own multiRange entries The vector of maps converts the ionids of the child MultiRange to the parent

Definition at line 844 of file multiRange.cpp.

References ASSERT, copyDataFromRange(), flattenToMassAxis(), AtomProbe::linkIdentifiers(), and AtomProbe::pairOverlaps().

Referenced by copyDataFromRange(), and AtomProbe::leastSquaresOverlapSolve().

Here is the call graph for this function:

◆ write()

bool AtomProbe::MultiRange::write ( const char *  fileName,
unsigned int  format = MULTIRANGE_FORMAT_XML 
) const

Save the structure to a file. format specifies output file format type.

Returns true if successful, otherwise false

Definition at line 327 of file multiRange.cpp.

References ASSERT, AtomProbe::LibVersion::getVersionStr(), isSelfConsistent(), AtomProbe::MULTIRANGE_FORMAT_XML, and AtomProbe::tabs().

Referenced by copyDataFromRange().

Here is the call graph for this function:

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