Utility functions for Image manipulation. More...
#include <ImageUtilities.h>
Static Public Member Functions | |
template<class T > | |
static void | openImage (PtrHolder< ImageInterface< T > > &image, const String &fileName) |
Open disk image (can be any registered image). | |
template<class T > | |
static void | openImage (ImageInterface< T > *&image, const String &fileName) |
template<class T > | |
static SHARED_PTR < ImageInterface< T > > | openImage (const String &fileName) |
template<typename T , typename U > | |
static void | copyMiscellaneous (ImageInterface< T > &out, const ImageInterface< U > &in, Bool copyImageInfo=True) |
Copy MiscInfo, ImageInfo, brightness unit and logger (history) from in to out. | |
template<typename T , typename U > | |
static void | copyMask (ImageInterface< T > &out, const ImageInterface< U > &in, const String &maskOut, const String &maskIn, AxesSpecifier axesSpecifier) |
Copy a mask from one image to another. | |
static void | copyAttributes (ImageAttrHandler &out, ImageAttrHandler &in) |
Copy the attributes from one image to another. | |
template<typename T > | |
static void | addDegenerateAxes (LogIO &os, PtrHolder< ImageInterface< T > > &outImage, const ImageInterface< T > &inImage, const String &outFile, Bool direction, Bool spectral, const String &stokes, Bool linear, Bool tabular, Bool overwrite, Bool silent=False) |
Add one degenerate axis for each of the specified coordinate types. | |
template<typename T > | |
static void | bin (MaskedArray< T > &out, Coordinate &coordOut, const MaskedArray< T > &in, const Coordinate &coordIn, uInt axis, uInt bin) |
Function to bin up (average data) one axis of an N-D MaskedArray. | |
static Bool | pixToWorld (Vector< String > &sWorld, const CoordinateSystem &cSys, const Int &pixelAxis, const Vector< Int > &cursorAxes, const IPosition &blc, const IPosition &trc, const Vector< Double > &pixels, const Int &prec, const Bool usePrecForMixed=False) |
This function converts pixel coordinates to world coordinates. | |
static String | shortAxisName (const String &axisName) |
Convert long axis names "Right Ascension", "Declination", "Frequency" and "Velocity" to "RA", "Dec", "Freq", "Vel" respectively. | |
static void | writeImage (const TiledShape &mapShape, const CoordinateSystem &coordinateInfo, const String &imageName, const Array< Float > &pixels, LogIO &log, const Array< Bool > &pixelMask=Array< Bool >()) |
write the specified image and add the specified pixels to it. | |
static GaussianBeam | makeFakeBeam (LogIO &logIO, const CoordinateSystem &csys, Bool suppressWarnings=False) |
static void | getUnitAndDoppler (String &xUnit, String &doppler, const uInt axis, const CoordinateSystem &csys) |
Utility functions for Image manipulation.
Public interface
Some helpful static functions that are common to some of my image analysis application classes.
I needed some bits and pieces. My goal isto move this rag-tag bunch out of here into other classes as time goes on. So far I have eliminated 80% of the original !
Definition at line 87 of file ImageUtilities.h.
static void casacore::ImageUtilities::addDegenerateAxes | ( | LogIO & | os, | |
PtrHolder< ImageInterface< T > > & | outImage, | |||
const ImageInterface< T > & | inImage, | |||
const String & | outFile, | |||
Bool | direction, | |||
Bool | spectral, | |||
const String & | stokes, | |||
Bool | linear, | |||
Bool | tabular, | |||
Bool | overwrite, | |||
Bool | silent = False | |||
) | [inline, static] |
Add one degenerate axis for each of the specified coordinate types.
If the outfile string is given the new image is a PagedImage. If the outfile string is empty, the new image is a TempImage.
static void casacore::ImageUtilities::bin | ( | MaskedArray< T > & | out, | |
Coordinate & | coordOut, | |||
const MaskedArray< T > & | in, | |||
const Coordinate & | coordIn, | |||
uInt | axis, | |||
uInt | bin | |||
) | [inline, static] |
Function to bin up (average data) one axis of an N-D MaskedArray.
The interface is pretty specific to a particular application. It's here because its implemented with ImageRebin. On input, the output MA *must* have zero shape. The input and output Coordinates must have the same type and have only one axis (Linear,Spectral & Tabular). The output coordinate is adjusted for the binning. The binning factor does not have to fit integrally into the shape of the specified axis.
static void casacore::ImageUtilities::copyAttributes | ( | ImageAttrHandler & | out, | |
ImageAttrHandler & | in | |||
) | [static] |
Copy the attributes from one image to another.
static void casacore::ImageUtilities::copyMask | ( | ImageInterface< T > & | out, | |
const ImageInterface< U > & | in, | |||
const String & | maskOut, | |||
const String & | maskIn, | |||
AxesSpecifier | axesSpecifier | |||
) | [inline, static] |
Copy a mask from one image to another.
static void casacore::ImageUtilities::copyMiscellaneous | ( | ImageInterface< T > & | out, | |
const ImageInterface< U > & | in, | |||
Bool | copyImageInfo = True | |||
) | [inline, static] |
Copy MiscInfo, ImageInfo, brightness unit and logger (history) from in to out.
static void casacore::ImageUtilities::getUnitAndDoppler | ( | String & | xUnit, | |
String & | doppler, | |||
const uInt | axis, | |||
const CoordinateSystem & | csys | |||
) | [static] |
static GaussianBeam casacore::ImageUtilities::makeFakeBeam | ( | LogIO & | logIO, | |
const CoordinateSystem & | csys, | |||
Bool | suppressWarnings = False | |||
) | [static] |
static SHARED_PTR<ImageInterface<T> > casacore::ImageUtilities::openImage | ( | const String & | fileName | ) | [inline, static] |
static void casacore::ImageUtilities::openImage | ( | ImageInterface< T > *& | image, | |
const String & | fileName | |||
) | [inline, static] |
static void casacore::ImageUtilities::openImage | ( | PtrHolder< ImageInterface< T > > & | image, | |
const String & | fileName | |||
) | [inline, static] |
static Bool casacore::ImageUtilities::pixToWorld | ( | Vector< String > & | sWorld, | |
const CoordinateSystem & | cSys, | |||
const Int & | pixelAxis, | |||
const Vector< Int > & | cursorAxes, | |||
const IPosition & | blc, | |||
const IPosition & | trc, | |||
const Vector< Double > & | pixels, | |||
const Int & | prec, | |||
const Bool | usePrecForMixed = False | |||
) | [static] |
This function converts pixel coordinates to world coordinates.
You specify a vector of pixel coordinates (pixels
) for only one axis, the pixelAxis
. For the other pixel axes in the CoordinateSystem
, if a pixel axis "i" is found in the CursorAxes
vector, its pixel coordinate is set to the average of the selected region from the image for that axis ((blc(i)+trc(i))/2)
), otherwise it is set to the reference pixel. The vector of world coordinates for pixelAxis
is returned as formatted Strings. If for some reason it can't make the conversion, the element element is returned as "?" Returns False
if the lengths of <blc
and trc
are not equal to the number of pixel axes in the coordinate system.
Convert long axis names "Right Ascension", "Declination", "Frequency" and "Velocity" to "RA", "Dec", "Freq", "Vel" respectively.
Unknown strings are returned as given.
static void casacore::ImageUtilities::writeImage | ( | const TiledShape & | mapShape, | |
const CoordinateSystem & | coordinateInfo, | |||
const String & | imageName, | |||
const Array< Float > & | pixels, | |||
LogIO & | log, | |||
const Array< Bool > & | pixelMask = Array< Bool >() | |||
) | [static] |
write the specified image and add the specified pixels to it.
Currently no checks are done to ensure the pixel array size and mapShape are compatible; the caller is responsible for this check.