casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Static Public Member Functions | List of all members
casacore::ImageUtilities Class Reference

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). More...
 
template<class T >
static void openImage (ImageInterface< T > *&image, const String &fileName)
 
template<class T >
static std::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. More...
 
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. More...
 
static void copyAttributes (ImageAttrHandler &out, ImageAttrHandler &in)
 Copy the attributes from one image to another. More...
 
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. More...
 
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. More...
 
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. More...
 
static String shortAxisName (const String &axisName)
 Convert long axis names "Right Ascension", "Declination", "Frequency" and "Velocity" to "RA", "Dec", "Freq", "Vel" respectively. More...
 
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. More...
 
static GaussianBeam makeFakeBeam (LogIO &logIO, const CoordinateSystem &csys, Bool suppressWarnings=False)
 
static void getUnitAndDoppler (String &xUnit, String &doppler, const uInt axis, const CoordinateSystem &csys)
 

Detailed Description

Utility functions for Image manipulation.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Synopsis

Some helpful static functions that are common to some of my image analysis application classes.

Motivation

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 !

To Do

Definition at line 87 of file ImageUtilities.h.

Member Function Documentation

template<typename T >
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 
)
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.

template<typename T >
static void casacore::ImageUtilities::bin ( MaskedArray< T > &  out,
Coordinate coordOut,
const MaskedArray< T > &  in,
const Coordinate coordIn,
uInt  axis,
uInt  bin 
)
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.

template<typename T , typename U >
static void casacore::ImageUtilities::copyMask ( ImageInterface< T > &  out,
const ImageInterface< U > &  in,
const String maskOut,
const String maskIn,
AxesSpecifier  axesSpecifier 
)
static

Copy a mask from one image to another.

template<typename T , typename U >
static void casacore::ImageUtilities::copyMiscellaneous ( ImageInterface< T > &  out,
const ImageInterface< U > &  in,
Bool  copyImageInfo = True 
)
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
template<class T >
static void casacore::ImageUtilities::openImage ( PtrHolder< ImageInterface< T > > &  image,
const String fileName 
)
static

Open disk image (can be any registered image).

Exception if fileName empty or file does not exist or file is not of legal image type. For Casacore images, the default mask is applied.

template<class T >
static void casacore::ImageUtilities::openImage ( ImageInterface< T > *&  image,
const String fileName 
)
static
template<class T >
static std::shared_ptr<ImageInterface<T> > casacore::ImageUtilities::openImage ( const String fileName)
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.

static String casacore::ImageUtilities::shortAxisName ( const String axisName)
static

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 = ArrayBool >() 
)
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.


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