Loading...
Searching...
No Matches
casacore::ImageUtilities Class Reference
images package (libcasa_images) » Images_module

More...

`#include <ImageUtilities.h>`

## Static Public Member Functions

template<class T>
static void | openImage (std::unique_ptr< 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 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.
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, std::unique_ptr< 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)

## Detailed Description

Utility functions for Image manipulation

### Intended use:

Public interface

### Review Status

Date Reviewed:
  yyyy/mm/dd

### Prerequisite

- IPosition
- Arrays
- Lattice

### 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 81 of file ImageUtilities.h.

## Member Function Documentation

## addDegenerateAxes()

template<typename T>

void casacore::ImageUtilities::addDegenerateAxes | ( | LogIO & | os,
|  | std::unique_ptr< 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.

References casacore::False.

## bin()

template<typename T>

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.

References bin().

Referenced by bin().

## copyAttributes()

void casacore::ImageUtilities::copyAttributes | ( | ImageAttrHandler & | out,
|  | ImageAttrHandler & | in )

static

Copy the attributes from one image to another.

## copyMask()

template<typename T, typename U>

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.

## copyMiscellaneous()

template<typename T, typename U>

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.

References casacore::True.

## getUnitAndDoppler()

void casacore::ImageUtilities::getUnitAndDoppler | ( | String & | xUnit,
|  | String & | doppler,
|  | const uInt | axis,
|  | const CoordinateSystem & | csys )

static

## makeFakeBeam()

GaussianBeam casacore::ImageUtilities::makeFakeBeam | ( | LogIO & | logIO,
|  | const CoordinateSystem & | csys,
|  | Bool | suppressWarnings = False )

static

References casacore::False.

## openImage() [1/3]

template<class T>

std::shared_ptr< ImageInterface< T > > casacore::ImageUtilities::openImage | ( | const String & | fileName | ) |

static

## openImage() [2/3]

template<class T>

void casacore::ImageUtilities::openImage | ( | ImageInterface< T > *& | image,
|  | const String & | fileName )

static

## openImage() [3/3]

template<class T>

void casacore::ImageUtilities::openImage | ( | std::unique_ptr< 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.

## pixToWorld()

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.

References casacore::False.

## shortAxisName()

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.

## writeImage()

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.

References casacore::log().

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

- images/Images/ImageUtilities.h