ImageProfileFit.h

Classes

ImageProfileFit -- (full description)

class ImageProfileFit

Interface

Public Members
explicit ImageProfileFit()
~ImageProfileFit()
ImageProfileFit(const ImageProfileFit& other)
ImageProfileFit& operator=(const ImageProfileFit& other)
void setData (const ImageInterface<Float>& image, const ImageRegion& region, uInt profileAxis, Bool average=True)
void setData (const ImageInterface<Float>& image, const ImageInterface<Float>& sigma, const ImageRegion& region, uInt profileAxis, Bool average=True)
void setData (const ImageInterface<Float>& image, uInt profileAxis, Bool average=True)
void setData (const ImageInterface<Float>& image, const ImageInterface<Float>& sigma, uInt profileAxis, Bool average=True)
void setData (const CoordinateSystem& cSys, uInt ProfileAxis, const Quantum<Vector<Float> >& x, const Quantum<Vector<Float> >& y, const Vector<Float>& sigma, Bool isAbs, const String& doppler)
void setData (const CoordinateSystem& cSys, uInt ProfileAxis, const Quantum<Vector<Float> >& x, const Quantum<Vector<Float> >& y, const Vector<Bool>& mask, const Vector<Float>& sigma, Bool isAbs, const String& doppler)
Bool estimate (uInt nMax = 0)
uInt addElements (const RecordInterface& estimate)
Bool getList (RecordInterface& rec, Bool xAbsOut, const String& xUnitOut, const String& dopplerOut)
SpectralList getList () const
void reset ()
uInt nElements ()
Bool fit(Int order=-1)
void fit (Bool fillRecord, RecordInterface& rec, Bool xAbsRec, const String& xUnitRec, const String& dopplerRec, ImageInterface<Float>* pFit, ImageInterface<Float>* pResid, Int order=-1)
void residual(Vector<Float>& resid, const Vector<Float>& x) const
void residual(Vector<Float>& resid) const
void model (Vector<Float>& model, const Vector<Float>& x) const
void model (Vector<Float>& model) const
Private Members
void collapse (Vector<Float>& profile, Vector<Bool>& mask, uInt profileAxis, const MaskedLattice<Float>& lat) const
SpectralElement convertSpectralElement (const SpectralElement& elIn, Bool xAbsIn, Bool xAbsOut, Bool oneRelIn, Bool oneRelOut, const String& xUnitIn, const String& xUnitOut, const String& dopplerIn, const String& dopplerOut, const String& yUnitIn, const String& yUnitOut)
void convertGaussianElementX (SpectralElement& el, CoordinateSystem& cSys, uInt profileAxis, Bool absIn, Bool absOut, const String& unitIn, const String& unitOut, const String& dopplerIn, const String& dopplerOut, Bool oneRelIn, Bool oneRelOut)
SpectralList filterList (const SpectralList& listIn) const
Bool getElements (RecordInterface& rec, Bool xAbsOut, const String& xUnitOut, const String& dopplerOut, const String& list)
void setData (const ImageInterface<Float>*& pSigma, const ImageInterface<Float>& image, const Slicer& sl, Bool average)

Description

Prerequisite

Synopsis

The Record used to contain models/fits is as follows. Other fields will be ignored.

    Field                     Type             Description
    -----------------------------------------------------------
    xabs                      Bool              Are the x-values absolute or 
                                                relative to the reference pixel
    xunit                     String            The x unit 
    yunit                     String            The y unit
    doppler                   String            doppler type ('radio', 'optical', 'true' etc)
                                                Only required if x unit consistent with m/s
    elements                  Record            Holds SpectralElement descriptions.  
    elements[i]               Record            There will be N of these where N is the
                                                number of spectral elements.  Each elements[i]
                                                holds a record description that SpectralElement::fromRecord
                                                can read or writes
            .type             String            Type of SE (gaussian, polynomial, etc)
            .parameters       Vector<Double>    The parameters of the element.
            .errors           Vector<Double>    The errors of parameters of the element.
            .fixed            Vector<Bool>      Says whether parameter is going to be held fixed when fitting
                                                This field is not used by SpectralElement.  If its
                                                not there, all parameters are fitted for.
    
    

Example


 

To Do

Member Description

explicit ImageProfileFit()

Constructor

~ImageProfileFit()

Destructor

ImageProfileFit(const ImageProfileFit& other)

Copy constructor. Uses copy semantics.

ImageProfileFit& operator=(const ImageProfileFit& other)

Assignment operator. Uses copy semantics.

void setData (const ImageInterface<Float>& image, const ImageRegion& region, uInt profileAxis, Bool average=True)
void setData (const ImageInterface<Float>& image, const ImageInterface<Float>& sigma, const ImageRegion& region, uInt profileAxis, Bool average=True)
void setData (const ImageInterface<Float>& image, uInt profileAxis, Bool average=True)
void setData (const ImageInterface<Float>& image, const ImageInterface<Float>& sigma, uInt profileAxis, Bool average=True)

Set data via an image. profileAxis specifies the profile pixel axis. You can either average the data over all other axes in the image (average=True) or fit all profiles in the image.

void setData (const CoordinateSystem& cSys, uInt ProfileAxis, const Quantum<Vector<Float> >& x, const Quantum<Vector<Float> >& y, const Vector<Float>& sigma, Bool isAbs, const String& doppler)
void setData (const CoordinateSystem& cSys, uInt ProfileAxis, const Quantum<Vector<Float> >& x, const Quantum<Vector<Float> >& y, const Vector<Bool>& mask, const Vector<Float>& sigma, Bool isAbs, const String& doppler)

Set the data directly, and provide a coordinate system and specify the profile axis in the coordinate system. The x-units can be 'pix'. If absolute they must be 0-rel pixels. isAbs specifies whether the coordinates are absolute or relative to the reference pixel. If the weights vector, sigma is of zero length, it is treated as all unity.

Bool estimate (uInt nMax = 0)

Makes an estimate from the set data. This means it generates SpectralElements holding the estimate, and replaces all elements you might have put in place with function addElement. Returns False if it can't find any elements.

uInt addElements (const RecordInterface& estimate)

Decode the Glish record holding SpectralElements and add them to the fitter. Absolute pixel coordinate units are assumed to be 1-rel on input. Return the number of the element added.

Bool getList (RecordInterface& rec, Bool xAbsOut, const String& xUnitOut, const String& dopplerOut)

Gets the internal SpectralElements (either estimate or fit depending on what function you called last) into a record. Only returns False if the field is already defined. Absolute pixel coordinate units are 1-rel on output.

SpectralList getList () const

Gets the internal SpectralElements (either estimate or fit depending on what function you called last) into a SpectralList Only returns False if the field is already defined. Absolute pixel coordinate units are 1-rel on output.

void reset ()

Reset the internal list of SpectralElements to null

uInt nElements ()

Return number of SpectralElements set

Bool fit(Int order=-1)

Do the fit of the averaged profile. Specify the order of the baseline you would also like to fit for.

void fit (Bool fillRecord, RecordInterface& rec, Bool xAbsRec, const String& xUnitRec, const String& dopplerRec, ImageInterface<Float>* pFit, ImageInterface<Float>* pResid, Int order=-1)

Fit all profiles with shapes + optional polynomial in the region and write out images. If fillRecord is True, the output record is filled with the the parameters of every fit. This can get VERY large so use with care. If the output images have a writable mask, the input mask is transferred to the output.

void residual(Vector<Float>& resid, const Vector<Float>& x) const
void residual(Vector<Float>& resid) const

Find the residuals (fit or estimate) of the averaged profile

void model (Vector<Float>& model, const Vector<Float>& x) const
void model (Vector<Float>& model) const

Find the model (fit or estimate) of the averaged profile

void collapse (Vector<Float>& profile, Vector<Bool>& mask, uInt profileAxis, const MaskedLattice<Float>& lat) const

True to fit all profiles in region

SpectralElement convertSpectralElement (const SpectralElement& elIn, Bool xAbsIn, Bool xAbsOut, Bool oneRelIn, Bool oneRelOut, const String& xUnitIn, const String& xUnitOut, const String& dopplerIn, const String& dopplerOut, const String& yUnitIn, const String& yUnitOut)

Convert SE

void convertGaussianElementX (SpectralElement& el, CoordinateSystem& cSys, uInt profileAxis, Bool absIn, Bool absOut, const String& unitIn, const String& unitOut, const String& dopplerIn, const String& dopplerOut, Bool oneRelIn, Bool oneRelOut)

Convert Gaussian model x-units when data source is an image

SpectralList filterList (const SpectralList& listIn) const

Bool getElements (RecordInterface& rec, Bool xAbsOut, const String& xUnitOut, const String& dopplerOut, const String& list)

void setData (const ImageInterface<Float>*& pSigma, const ImageInterface<Float>& image, const Slicer& sl, Bool average)