Andreoffringa

AOFlagger ImageSet Class Reference

{"html":"

AOFlagger ImageSet Class Reference

The ImageSet class is a foundational building block of AOFlagger, the radio-frequency interference mitigation platform created by André Offringa. It acts as a container that manages several images—for example Stokes parameters or frequency bands—as one logical unit, so flagging and analysis can be carried out efficiently across the whole collection.

Overview

Within AOFlagger, an ImageSet groups images that share common metadata and are processed together. This abstraction is especially valuable for multi-frequency or multi-polarization data, where flagging choices often rely on how images relate to one another. The class takes care of loading, saving, and accessing individual images while keeping the set consistent throughout.

ImageSet is usually combined with AOFlagger's flagging strategies and quality assessment tools. It lets algorithms work on the entire set without managing each image separately, which simplifies code and lowers the chance of mistakes.

Key Features

  • Multi-image management: Store and access several images as a single entity, with indexing and iteration support.
  • Metadata handling: Preserve and propagate metadata such as observation parameters, coordinate systems, and units across every image in the set.
  • I/O operations: Read from and write to common astronomical image formats, including FITS, with automatic handling of data types and scaling.
  • Integration with flagging algorithms: Built to work seamlessly with AOFlagger's flagging strategies so flags are applied consistently across the set.
  • Memory efficiency: Lazy loading and caching mechanisms help manage large datasets without excessive memory usage.

Usage Example

The example below shows how to create an ImageSet, load images from FITS files, and apply a simple flagging operation. It is illustrative only and may need adaptation for your specific AOFlagger version and data.

#include <aoflagger/msio/imageset.h>

// Create an ImageSet
aoflagger::ImageSet imageSet;

// Load images from FITS files
imageSet.Load(\"observation.fits\");

// Access the first image
aoflagger::Image& image = imageSet.GetImage(0);

// Apply flagging (using a strategy)
aoflagger::Strategy strategy = aoflagger::Strategy::CreateFromFile(\"strategy.rfis\");
strategy.Run(imageSet);

// Save the flagged images
imageSet.Save(\"flagged.fits\");

For detailed API information, consult the class declaration in the AOFlagger source code and the accompanying Doxygen documentation.

Related Classes and Functions

The ImageSet class interacts with several other AOFlagger components:

  • Image: Represents a single image within the set, providing pixel access and basic operations.
  • Strategy: Defines the flagging algorithm applied to an ImageSet.
  • FlagMask: Holds flagging information for an image or a set of images.
  • ImageSetReader and ImageSetWriter: Manage input and output for ImageSet objects.

These classes belong to the aoflagger namespace and are documented in the AOFlagger API reference.

Frequently Asked Questions

What is the difference between an ImageSet and a single Image?
An ImageSet manages multiple images as a group, while an Image represents a single image. Use an ImageSet when your data consists of multiple related images (e.g., different frequencies or Stokes parameters) that should be processed together.
Can I access individual images within an ImageSet?
Yes. The ImageSet provides methods such as GetImage(index) to access individual images by their index, and you can also iterate over the set using standard container iterators.
How do I load images into an ImageSet?
Images can be loaded from FITS files using the Load method, which accepts a filename or a list of filenames. The class automatically handles reading and parsing of the FITS headers and data.
Is ImageSet thread-safe?
Like most AOFlagger classes, ImageSet is not inherently thread-safe. If you need to process images in parallel, make sure each thread operates on a separate ImageSet instance or use appropriate synchronization mechanisms.
Where can I find more information about AOFlagger?
Visit the AOFlagger homepage for an overview, tutorials, and links to the source code repository. The Doxygen-generated API documentation provides detailed class references.
Visit AOFlagger Homepage
"}

Working with an ImageSet keeps related images—such as different frequencies or Stokes parameters—organized under shared metadata, so flagging strategies can be applied uniformly. Pair it with the Image, Strategy, and FlagMask classes described above to build a complete AOFlagger workflow.