A class for exporting regions in DS9 format.  
 More...
#include <Ds9Exporter.h>
 | 
|   | Ds9Exporter (std::shared_ptr< casacore::CoordinateSystem > coord_sys, const casacore::IPosition &shape, bool export_pixels) | 
|   | Constructor for Ds9Exporter class for exporting regions to DS9 file.  
  | 
|   | 
|   | RegionExporter (std::shared_ptr< casacore::CoordinateSystem > coord_sys, const casacore::IPosition &shape) | 
|   | Constructor for RegionExporter class.  
  | 
|   | 
| virtual  | ~RegionExporter ()=default | 
|   | Default destructor.  
  | 
|   | 
| bool  | CanExportToFile (const std::string &filename, bool overwrite, CARTA::ExportRegionAck &export_ack) | 
|   | Determine if export file can be created or overwritten.  
  | 
|   | 
| bool  | AddRegion (int file_id, std::shared_ptr< Region > region, const CARTA::RegionStyle ®ion_style, bool export_pixels) | 
|   | Add file line for region.  
  | 
|   | 
| void  | ExportRegions (const std::string &filename, std::string &message, CARTA::ExportRegionAck &export_ack) | 
|   | Export region file lines to file or contents.  
  | 
|   | 
 | 
| bool  | AddRegion (const RegionState ®ion_state, const CARTA::RegionStyle ®ion_style) override | 
|   | Add file line for region in pixel coordinates.  
  | 
|   | 
| bool  | AddRegion (CARTA::RegionType region_type, const std::vector< casacore::Quantity > &control_points, const casacore::Quantity &rotation, const CARTA::RegionStyle ®ion_style) override | 
|   | Add file line for region in world coordinates or in matched image.  
  | 
|   | 
| bool  | ExportRegions (const std::string &filename, std::string &error) override | 
|   | Write region file lines to filename.  
  | 
|   | 
| bool  | ExportRegions (std::vector< std::string > &contents, std::string &error) override | 
|   | Set contents to region file lines.  
  | 
|   | 
| bool  | AddRegion (const RegionState ®ion_state, const CARTA::RegionStyle ®ion_style, const casacore::RecordInterface ®ion_record, bool export_pixels) | 
|   | Add file line for region in world coordinates or for matched image.  
  | 
|   | 
| void  | AddCompassStyle (const CARTA::RegionStyle ®ion_style, const std::string &coord_frame, std::string &file_line) | 
|   | Append compass style parameters to region file line.  
  | 
|   | 
 | 
| void  | InitGlobalProperties () | 
|   | Set global properties to DS9 defaults.  
  | 
|   | 
| void  | SetFileCoordFrame () | 
|   | Set frame to use for file lines from image coordinate system.  
  | 
|   | 
| std::string  | CasacoreFrameToDs9 (const std::string &casacore_frame) | 
|   | Convert casacore coordinate frame string to DS9 frame.  
  | 
|   | 
| std::vector< std::string >  | GetFileHeader () | 
|   | Return DS9 file header lines.  
  | 
|   | 
| std::string  | GetRegionPixelLine (CARTA::RegionType region_type, const std::vector< casacore::Quantity > &control_points, float rotation, const CARTA::RegionStyle ®ion_style) | 
|   | Create region file line using pixel coordinates.  
  | 
|   | 
| std::string  | GetRegionWorldLine (CARTA::RegionType region_type, const std::vector< casacore::Quantity > &control_points, float rotation, const CARTA::RegionStyle ®ion_style) | 
|   | Create region file line using world coordinates.  
  | 
|   | 
| void  | AddStyle (const CARTA::RegionStyle ®ion_style, std::string &file_line) | 
|   | Add DS9 style parameters common to all region types to file line.  
  | 
|   | 
| void  | AddTextboxStyle (const CARTA::RegionStyle ®ion_style, std::string &file_line) | 
|   | Add textbox region style to file line.  
  | 
|   | 
| void  | AddFontStyle (const CARTA::RegionStyle ®ion_style, std::string &file_line) | 
|   | Add font style parameters to file line.  
  | 
|   | 
| void  | AddAnnotationStyle (CARTA::RegionType region_type, const CARTA::RegionStyle ®ion_style, std::string &file_line) | 
|   | Add annotation style parameters to file line.  
  | 
|   | 
| void  | AddAnnPointStyle (const CARTA::RegionStyle ®ion_style, std::string &file_line) | 
|   | Add annotation point region style to file line.  
  | 
|   | 
 | 
| static std::unordered_map< std::string, std::string >  | _coordinate_frames | 
|   | Casacore to DS9 coordinate frame.  
  | 
|   | 
 | 
| std::shared_ptr< casacore::CoordinateSystem >  | _coord_sys | 
|   | Image coordinate system.  
  | 
|   | 
| casacore::IPosition  | _image_shape | 
|   | Image shape.  
  | 
|   | 
| std::unordered_map< CARTA::RegionType, std::string >  | _region_names | 
|   | Region names for conversion from CARTA type to CRTF or DS9 name.  
  | 
|   | 
| std::string  | _image_coord_frame | 
|   | casacore image reference frame from coordinate system.  
  | 
|   | 
| std::string  | _file_coord_frame | 
|   | Coordinate frame for file lines.  
  | 
|   | 
| std::vector< std::string >  | _file_lines | 
|   | Formatted lines for header, globals, and regions for region file.  
  | 
|   | 
A class for exporting regions in DS9 format. 
 
◆ Ds9Exporter()
      
        
          | Ds9Exporter::Ds9Exporter  | 
          ( | 
          std::shared_ptr< casacore::CoordinateSystem >  | 
          coord_sys,  | 
        
        
           | 
           | 
          const casacore::IPosition &  | 
          shape,  | 
        
        
           | 
           | 
          bool  | 
          export_pixels  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Constructor for Ds9Exporter class for exporting regions to DS9 file. 
- Parameters
 - 
  
    | coord_sys | casacore::CoordinateSystem of image from which region is exported  | 
    | shape | casacore::IPosition describing shape of image from which region is exported  | 
    | export_pixels | Whether to export in pixel or world coordinates.  | 
  
   
 
 
◆ AddAnnotationStyle()
  
  
      
        
          | void Ds9Exporter::AddAnnotationStyle  | 
          ( | 
          CARTA::RegionType  | 
          region_type,  | 
         
        
           | 
           | 
          const CARTA::RegionStyle &  | 
          region_style,  | 
         
        
           | 
           | 
          std::string &  | 
          file_line  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
private   | 
  
 
Add annotation style parameters to file line. 
- Parameters
 - 
  
    | [in] | region_type | Region type  | 
    | [in] | region_style | Region style parameters  | 
    | [in,out] | file_line | File line to append  | 
  
   
 
 
◆ AddAnnPointStyle()
  
  
      
        
          | void Ds9Exporter::AddAnnPointStyle  | 
          ( | 
          const CARTA::RegionStyle &  | 
          region_style,  | 
         
        
           | 
           | 
          std::string &  | 
          file_line  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
private   | 
  
 
Add annotation point region style to file line. 
- Parameters
 - 
  
    | [in] | region_style | Region style parameters  | 
    | [in,out] | file_line | File line to append  | 
  
   
 
 
◆ AddFontStyle()
  
  
      
        
          | void Ds9Exporter::AddFontStyle  | 
          ( | 
          const CARTA::RegionStyle &  | 
          region_style,  | 
         
        
           | 
           | 
          std::string &  | 
          file_line  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
private   | 
  
 
Add font style parameters to file line. 
- Parameters
 - 
  
    | [in] | region_style | Region style parameters  | 
    | [in,out] | file_line | File line to append  | 
  
   
 
 
◆ AddRegion() [1/2]
  
  
      
        
          | bool Ds9Exporter::AddRegion  | 
          ( | 
          CARTA::RegionType  | 
          region_type,  | 
         
        
           | 
           | 
          const std::vector< casacore::Quantity > &  | 
          control_points,  | 
         
        
           | 
           | 
          const casacore::Quantity &  | 
          rotation,  | 
         
        
           | 
           | 
          const CARTA::RegionStyle &  | 
          region_style  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
overrideprotectedvirtual   | 
  
 
Add file line for region in world coordinates or in matched image. 
- Parameters
 - 
  
    | region_type | Region type  | 
    | control_points | Region control points in world coordinates  | 
    | rotation | Region rotation  | 
    | region_style | Region style parameters  | 
  
   
- Returns
 - Whether adding the file line is successful 
 
Implements carta::RegionExporter.
 
 
◆ AddRegion() [2/2]
  
  
      
        
          | bool Ds9Exporter::AddRegion  | 
          ( | 
          const RegionState &  | 
          region_state,  | 
         
        
           | 
           | 
          const CARTA::RegionStyle &  | 
          region_style  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
overrideprotectedvirtual   | 
  
 
Add file line for region in pixel coordinates. 
- Parameters
 - 
  
    | region_state | Region definition parameters  | 
    | region_style | Region style parameters  | 
  
   
- Returns
 - Whether adding the file line is successful 
 
Implements carta::RegionExporter.
 
 
◆ AddStyle()
  
  
      
        
          | void Ds9Exporter::AddStyle  | 
          ( | 
          const CARTA::RegionStyle &  | 
          region_style,  | 
         
        
           | 
           | 
          std::string &  | 
          file_line  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
private   | 
  
 
Add DS9 style parameters common to all region types to file line. 
- Parameters
 - 
  
    | [in] | region_style | Region style parameters  | 
    | [in,out] | file_line | File line to append  | 
  
   
 
 
◆ AddTextboxStyle()
  
  
      
        
          | void Ds9Exporter::AddTextboxStyle  | 
          ( | 
          const CARTA::RegionStyle &  | 
          region_style,  | 
         
        
           | 
           | 
          std::string &  | 
          file_line  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
private   | 
  
 
Add textbox region style to file line. 
- Parameters
 - 
  
    | [in] | region_style | Region style parameters  | 
    | [in,out] | file_line | File line to append  | 
  
   
 
 
◆ CasacoreFrameToDs9()
  
  
      
        
          | std::string Ds9Exporter::CasacoreFrameToDs9  | 
          ( | 
          const std::string &  | 
          casacore_frame | ) | 
           | 
         
       
   | 
  
private   | 
  
 
Convert casacore coordinate frame string to DS9 frame. 
- Parameters
 - 
  
    | casacore_frame | Coordinate frame in casacore format  | 
  
   
- Returns
 - Coordinate frame in DS9 format 
 
 
 
◆ ExportRegions() [1/2]
  
  
      
        
          | bool Ds9Exporter::ExportRegions  | 
          ( | 
          const std::string &  | 
          filename,  | 
         
        
           | 
           | 
          std::string &  | 
          error  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
overrideprotectedvirtual   | 
  
 
Write region file lines to filename. 
- Parameters
 - 
  
    | [in] | filename | Name of region file  | 
    | [out] | error | Message describing error if export fails  | 
  
   
- Returns
 - Whether writing any file lines is successful 
 
Implements carta::RegionExporter.
 
 
◆ ExportRegions() [2/2]
  
  
      
        
          | bool Ds9Exporter::ExportRegions  | 
          ( | 
          std::vector< std::string > &  | 
          contents,  | 
         
        
           | 
           | 
          std::string &  | 
          error  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
overrideprotectedvirtual   | 
  
 
Set contents to region file lines. 
- Parameters
 - 
  
    | [out] | contents | Vector for lines  | 
    | [out] | error | Message describing error if export fails  | 
  
   
- Returns
 - Whether writing any file lines is successful 
 
Implements carta::RegionExporter.
 
 
◆ GetFileHeader()
  
  
      
        
          | std::vector< std::string > Ds9Exporter::GetFileHeader  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
private   | 
  
 
Return DS9 file header lines. 
 
 
◆ GetRegionPixelLine()
  
  
      
        
          | std::string Ds9Exporter::GetRegionPixelLine  | 
          ( | 
          CARTA::RegionType  | 
          region_type,  | 
         
        
           | 
           | 
          const std::vector< casacore::Quantity > &  | 
          control_points,  | 
         
        
           | 
           | 
          float  | 
          rotation,  | 
         
        
           | 
           | 
          const CARTA::RegionStyle &  | 
          region_style  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
private   | 
  
 
Create region file line using pixel coordinates. 
- Parameters
 - 
  
    | region_type | Region type  | 
    | control_points | Region control points in pixel coordinates  | 
    | rotation | Region rotation in degrees  | 
    | region_style | Region style parameters  | 
  
   
- Returns
 - file line for region 
 
 
 
◆ GetRegionWorldLine()
  
  
      
        
          | std::string Ds9Exporter::GetRegionWorldLine  | 
          ( | 
          CARTA::RegionType  | 
          region_type,  | 
         
        
           | 
           | 
          const std::vector< casacore::Quantity > &  | 
          control_points,  | 
         
        
           | 
           | 
          float  | 
          rotation,  | 
         
        
           | 
           | 
          const CARTA::RegionStyle &  | 
          region_style  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
private   | 
  
 
Create region file line using world coordinates. 
- Parameters
 - 
  
    | region_type | Region type  | 
    | control_points | Region control points in world coordinates  | 
    | rotation | Region rotation in degrees  | 
    | region_style | Region style parameters  | 
  
   
- Returns
 - file line for region 
 
 
 
◆ InitGlobalProperties()
  
  
      
        
          | void carta::Ds9Exporter::InitGlobalProperties  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
private   | 
  
 
Set global properties to DS9 defaults. 
 
 
◆ SetFileCoordFrame()
  
  
      
        
          | void Ds9Exporter::SetFileCoordFrame  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
private   | 
  
 
Set frame to use for file lines from image coordinate system. 
 
 
◆ _coordinate_frames
  
  
      
        
          | std::unordered_map< std::string, std::string > Ds9Exporter::_coordinate_frames | 
         
       
   | 
  
staticprivate   | 
  
 
Initial value:{
    {"B1950", "fk4"}, {"J2000", "fk5"}, {"GALACTIC", "galactic"}, {"ECLIPTIC", "ecliptic"}, {"ICRS", "icrs"}}
 
Casacore to DS9 coordinate frame. 
 
 
◆ _export_pixels
  
  
      
        
          | bool carta::Ds9Exporter::_export_pixels | 
         
       
   | 
  
private   | 
  
 
Whether to export in pixel or world coordinates. 
 
 
◆ _global_properties
  
  
      
        
          | std::unordered_map<std::string, std::string> carta::Ds9Exporter::_global_properties | 
         
       
   | 
  
private   | 
  
 
 
The documentation for this class was generated from the following files: