Base class for exporting regions to file.  
 More...
#include <RegionExporter.h>
 | 
|   | 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.  
  | 
|   | 
 | 
| virtual bool  | AddRegion (const RegionState ®ion_state, const CARTA::RegionStyle ®ion_style)=0 | 
|   | Add file line for region in pixel coordinates.  
  | 
|   | 
| virtual bool  | AddRegion (CARTA::RegionType region_type, const std::vector< casacore::Quantity > &control_points, const casacore::Quantity &rotation, const CARTA::RegionStyle ®ion_style)=0 | 
|   | Add file line for region in world coordinates or in matched image.  
  | 
|   | 
| virtual bool  | ExportRegions (const std::string &filename, std::string &error)=0 | 
|   | Write region file lines to filename.  
  | 
|   | 
| virtual bool  | ExportRegions (std::vector< std::string > &contents, std::string &error)=0 | 
|   | Serialise region file lines to vector.  
  | 
|   | 
| 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.  
  | 
|   | 
 | 
| 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.  
  | 
|   | 
 | 
| bool  | ConvertRecordToPoint (const casacore::RecordInterface ®ion_record, bool export_pixels, std::vector< casacore::Quantity > &control_points) | 
|   | Convert casacore Record to point region control points.  
  | 
|   | 
| bool  | ConvertRecordToRectangle (const casacore::RecordInterface ®ion_record, bool export_pixels, std::vector< casacore::Quantity > &control_points) | 
|   | Convert casacore Record to rectangle region control points.  
  | 
|   | 
| bool  | ConvertRecordToEllipse (const RegionState ®ion_state, const casacore::RecordInterface ®ion_record, bool export_pixels, std::vector< casacore::Quantity > &control_points, casacore::Quantity &qrotation) | 
|   | Convert casacore Record to ellipse/circle region control points and rotation.  
  | 
|   | 
| bool  | ConvertRecordToPolygonLine (const casacore::RecordInterface ®ion_record, bool export_pixels, std::vector< casacore::Quantity > &control_points) | 
|   | Convert casacore Record to polygon/polyline region control points.  
  | 
|   | 
| casacore::Vector< casacore::Double >  | FloatVectorToDouble (const casacore::Vector< casacore::Float > &float_vector) | 
|   | Convert casacore Vector from float to double.  
  | 
|   | 
Base class for exporting regions to file. 
 
◆ RegionExporter()
      
        
          | RegionExporter::RegionExporter  | 
          ( | 
          std::shared_ptr< casacore::CoordinateSystem >  | 
          coord_sys,  | 
        
        
           | 
           | 
          const casacore::IPosition &  | 
          shape  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Constructor for RegionExporter class. 
- Parameters
 - 
  
    | coord_sys | casacore::CoordinateSystem of image from which region is exported  | 
    | shape | casacore::IPosition shape of image from which region is exported  | 
  
   
 
 
◆ ~RegionExporter()
  
  
      
        
          | virtual carta::RegionExporter::~RegionExporter  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
virtualdefault   | 
  
 
 
◆ AddCompassStyle()
  
  
      
        
          | void RegionExporter::AddCompassStyle  | 
          ( | 
          const CARTA::RegionStyle &  | 
          region_style,  | 
         
        
           | 
           | 
          const std::string &  | 
          coord_frame,  | 
         
        
           | 
           | 
          std::string &  | 
          file_line  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
protected   | 
  
 
Append compass style parameters to region file line. 
- Parameters
 - 
  
    | [in] | region_style | Region style parameters  | 
    | [in] | coord_frame | Coordinate frame for compass region  | 
    | [in,out] | file_line | Line to be appended  | 
  
   
 
 
◆ AddRegion() [1/4]
  
  
      
        
          | virtual bool carta::RegionExporter::AddRegion  | 
          ( | 
          CARTA::RegionType  | 
          region_type,  | 
         
        
           | 
           | 
          const std::vector< casacore::Quantity > &  | 
          control_points,  | 
         
        
           | 
           | 
          const casacore::Quantity &  | 
          rotation,  | 
         
        
           | 
           | 
          const CARTA::RegionStyle &  | 
          region_style  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
protectedpure virtual   | 
  
 
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 region file line is successful 
 
Implemented in carta::CrtfExporter, and carta::Ds9Exporter.
 
 
◆ AddRegion() [2/4]
  
  
      
        
          | virtual bool carta::RegionExporter::AddRegion  | 
          ( | 
          const RegionState &  | 
          region_state,  | 
         
        
           | 
           | 
          const CARTA::RegionStyle &  | 
          region_style  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
protectedpure virtual   | 
  
 
Add file line for region in pixel coordinates. 
- Parameters
 - 
  
    | region_state | Region definition parameters  | 
    | region_style | Region style parameters  | 
  
   
- Returns
 - Whether adding the region file line is successful 
 
Implemented in carta::CrtfExporter, and carta::Ds9Exporter.
 
 
◆ AddRegion() [3/4]
  
  
      
        
          | bool RegionExporter::AddRegion  | 
          ( | 
          const RegionState &  | 
          region_state,  | 
         
        
           | 
           | 
          const CARTA::RegionStyle &  | 
          region_style,  | 
         
        
           | 
           | 
          const casacore::RecordInterface &  | 
          region_record,  | 
         
        
           | 
           | 
          bool  | 
          export_pixels  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
protected   | 
  
 
Add file line for region in world coordinates or for matched image. 
- Parameters
 - 
  
    | region_state | Region definition parameters  | 
    | region_style | Region style parameters  | 
    | region_record | casacore Record created from LCRegion applied to image  | 
    | export_pixels | Whether to export region in pixel or world coordinates  | 
  
   
- Returns
 - Whether region is exported successfully 
 
 
 
◆ AddRegion() [4/4]
      
        
          | bool RegionExporter::AddRegion  | 
          ( | 
          int  | 
          file_id,  | 
        
        
           | 
           | 
          std::shared_ptr< Region >  | 
          region,  | 
        
        
           | 
           | 
          const CARTA::RegionStyle &  | 
          region_style,  | 
        
        
           | 
           | 
          bool  | 
          export_pixels  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Add file line for region. 
- Parameters
 - 
  
    | file_id | File id for image from which region is exported  | 
    | region | Region to export  | 
    | region_style | Region style parameters  | 
    | export_pixels | Whether to export region in pixel or world coordinates  | 
  
   
- Returns
 - Whether adding the region file line is successful 
 
 
 
◆ CanExportToFile()
      
        
          | bool RegionExporter::CanExportToFile  | 
          ( | 
          const std::string &  | 
          filename,  | 
        
        
           | 
           | 
          bool  | 
          overwrite,  | 
        
        
           | 
           | 
          CARTA::ExportRegionAck &  | 
          export_ack  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Determine if export file can be created or overwritten. 
- Parameters
 - 
  
    | [in] | filename | Name of region file  | 
    | [in] | overwrite | Whether existing file can be overwritten  | 
    | [out] | export_ack | CARTA ExportRegionAck message to complete if error.  | 
  
   
- Returns
 - Whether export file can be written. 
 
 
 
◆ ConvertRecordToEllipse()
  
  
      
        
          | bool RegionExporter::ConvertRecordToEllipse  | 
          ( | 
          const RegionState &  | 
          region_state,  | 
         
        
           | 
           | 
          const casacore::RecordInterface &  | 
          region_record,  | 
         
        
           | 
           | 
          bool  | 
          export_pixels,  | 
         
        
           | 
           | 
          std::vector< casacore::Quantity > &  | 
          control_points,  | 
         
        
           | 
           | 
          casacore::Quantity &  | 
          qrotation  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
private   | 
  
 
Convert casacore Record to ellipse/circle region control points and rotation. 
- Parameters
 - 
  
    | [in] | region_state | Region definition parameters  | 
    | [in] | region_record | casacore Record created from casacore LCRegion  | 
    | [in] | export_pixels | Whether to set control points in pixel or world coordinates  | 
    | [out] | control_points | Region control points  | 
    | [out] | qrotation | Region rotation  | 
  
   
- Returns
 - Whether the conversion is successful 
 
 
 
◆ ConvertRecordToPoint()
  
  
      
        
          | bool RegionExporter::ConvertRecordToPoint  | 
          ( | 
          const casacore::RecordInterface &  | 
          region_record,  | 
         
        
           | 
           | 
          bool  | 
          export_pixels,  | 
         
        
           | 
           | 
          std::vector< casacore::Quantity > &  | 
          control_points  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
private   | 
  
 
Convert casacore Record to point region control points. 
- Parameters
 - 
  
    | [in] | region_record | casacore Record created from casacore LCRegion  | 
    | [in] | export_pixels | Whether to set control points in pixel or world coordinates  | 
    | [out] | control_points | Region control points  | 
  
   
- Returns
 - Whether the conversion is successful 
 
 
 
◆ ConvertRecordToPolygonLine()
  
  
      
        
          | bool RegionExporter::ConvertRecordToPolygonLine  | 
          ( | 
          const casacore::RecordInterface &  | 
          region_record,  | 
         
        
           | 
           | 
          bool  | 
          export_pixels,  | 
         
        
           | 
           | 
          std::vector< casacore::Quantity > &  | 
          control_points  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
private   | 
  
 
Convert casacore Record to polygon/polyline region control points. 
- Parameters
 - 
  
    | [in] | region_record | casacore Record created from casacore LCRegion  | 
    | [in] | export_pixels | Whether to set control points in pixel or world coordinates  | 
    | [out] | control_points | Region control points  | 
  
   
- Returns
 - Whether the conversion is successful 
 
 
 
◆ ConvertRecordToRectangle()
  
  
      
        
          | bool RegionExporter::ConvertRecordToRectangle  | 
          ( | 
          const casacore::RecordInterface &  | 
          region_record,  | 
         
        
           | 
           | 
          bool  | 
          export_pixels,  | 
         
        
           | 
           | 
          std::vector< casacore::Quantity > &  | 
          control_points  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
private   | 
  
 
Convert casacore Record to rectangle region control points. 
- Parameters
 - 
  
    | [in] | region_record | casacore Record created from casacore LCRegion  | 
    | [in] | export_pixels | Whether to set control points in pixel or world coordinates  | 
    | [out] | control_points | Region control points  | 
  
   
- Returns
 - Whether the conversion is successful 
 
 
 
◆ ExportRegions() [1/3]
  
  
      
        
          | virtual bool carta::RegionExporter::ExportRegions  | 
          ( | 
          const std::string &  | 
          filename,  | 
         
        
           | 
           | 
          std::string &  | 
          error  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
protectedpure virtual   | 
  
 
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 region lines is successful 
 
Implemented in carta::CrtfExporter, and carta::Ds9Exporter.
 
 
◆ ExportRegions() [2/3]
      
        
          | void RegionExporter::ExportRegions  | 
          ( | 
          const std::string &  | 
          filename,  | 
        
        
           | 
           | 
          std::string &  | 
          message,  | 
        
        
           | 
           | 
          CARTA::ExportRegionAck &  | 
          export_ack  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Export region file lines to file or contents. 
- Parameters
 - 
  
    | [in] | filename | Filename to use for export; if empty, export to contents in ack message  | 
    | [in] | message | Any errors from adding regions to add to ack message.  | 
    | [out] | export_ack | Response message to complete  | 
  
   
 
 
◆ ExportRegions() [3/3]
  
  
      
        
          | virtual bool carta::RegionExporter::ExportRegions  | 
          ( | 
          std::vector< std::string > &  | 
          contents,  | 
         
        
           | 
           | 
          std::string &  | 
          error  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
protectedpure virtual   | 
  
 
Serialise region file lines to vector. 
- Parameters
 - 
  
    | [out] | contents | Vector for lines  | 
    | [out] | error | Message describing error if export fails  | 
  
   
- Returns
 - Whether writing any region lines is successful 
 
Implemented in carta::CrtfExporter, and carta::Ds9Exporter.
 
 
◆ FloatVectorToDouble()
  
  
      
        
          | casacore::Vector< casacore::Double > RegionExporter::FloatVectorToDouble  | 
          ( | 
          const casacore::Vector< casacore::Float > &  | 
          float_vector | ) | 
           | 
         
       
   | 
  
private   | 
  
 
Convert casacore Vector from float to double. 
- Parameters
 - 
  
    | float_vector | Float vector to convert  | 
  
   
- Returns
 - vector 
 
 
 
◆ _coord_sys
  
  
      
        
          | std::shared_ptr<casacore::CoordinateSystem> carta::RegionExporter::_coord_sys | 
         
       
   | 
  
protected   | 
  
 
 
◆ _file_coord_frame
  
  
      
        
          | std::string carta::RegionExporter::_file_coord_frame | 
         
       
   | 
  
protected   | 
  
 
Coordinate frame for file lines. 
 
 
◆ _file_lines
  
  
      
        
          | std::vector<std::string> carta::RegionExporter::_file_lines | 
         
       
   | 
  
protected   | 
  
 
Formatted lines for header, globals, and regions for region file. 
 
 
◆ _image_coord_frame
  
  
      
        
          | std::string carta::RegionExporter::_image_coord_frame | 
         
       
   | 
  
protected   | 
  
 
casacore image reference frame from coordinate system. 
 
 
◆ _image_shape
  
  
      
        
          | casacore::IPosition carta::RegionExporter::_image_shape | 
         
       
   | 
  
protected   | 
  
 
 
◆ _region_names
  
  
      
        
          | std::unordered_map<CARTA::RegionType, std::string> carta::RegionExporter::_region_names | 
         
       
   | 
  
protected   | 
  
 
Region names for conversion from CARTA type to CRTF or DS9 name. 
 
 
The documentation for this class was generated from the following files: