245 if (status)
goto ERR;
255 if (status)
goto ERR;
265 if (status)
goto ERR;
269 for (
int i = 1; i <=
nkeys; i++) {
271 if (status)
goto ERR;
281 for (
int i = 0; i <
nkeys; i++) {
282 if (
fRecords[i].fKeyword ==
"EXTNAME") {
290 Info(
"LoadHDU",
"The selected HDU contains an Image Extension");
297 if (status)
goto ERR;
348 Info(
"LoadHDU",
"The selected HDU contains a Table Extension");
355 if (status)
goto ERR;
360 if (status)
goto ERR;
392 if (status)
goto ERR;
404 if (status)
goto ERR;
407 char *
nulval = (
char*)
"";
424 delete [] array[row];
452 double *array =
nullptr;
489 int temp = (
signed char)
arrayl[row];
568 std::vector<short>
data;
571 for (
int i = 0; i <
size; i++)
574 std::vector<int>
data;
577 for (
int i = 0; i <
size; i++)
580 std::vector<float>
data;
583 for (
int i = 0; i <
size; i++)
586 std::vector<double>
data;
589 for (
int i = 0; i <
size; i++)
592 Error(
"LoadHDU",
"The variable-length array type in column %d is unknown",
colnum + 1);
598 Warning(
"LoadHDU",
"error opening FITS file. Column type %d is currently not supported",
typecode);
654 if (
fRecords[i].fComment.Length() > 0) {
674 int verbose = (opt[0] ? 1 : 0);
678 if (status)
goto ERR;
682 if (status)
goto ERR;
689 if (status)
goto ERR;
706 if (status)
goto ERR;
710 for (
int i = 1; i <=
nkeys; i++) {
719 records[i-1].fComment = comment;
732 for (
int i = 0; i <
nkeys; i++) {
748 if (status)
goto ERR;
758 Warning(
"PrintFileMetadata",
"error opening FITS file. Details: %s",
errdescr);
769 Warning(
"PrintColumnInfo",
"this is not a table HDU.");
799 Warning(
"PrintColumnInfo",
"this is not a table HDU.");
807 Warning(
"PrintColumnInfo",
"The table contains column with fixed-length arrays and cannot be flattened for printing.");
811 Warning(
"PrintColumnInfo",
"The table contains column with variable-length arrays and cannot be flattened for printing.");
860 if ((opt[0] ==
'F') || (opt[0] ==
'f')) {
862 }
else if ((opt[0] ==
'T') || (opt[0] ==
't')) {
883 Warning(
"ReadAsImage",
"this is not an image HDU.");
888 Warning(
"ReadAsImage",
"could not convert image HDU to image because it has %d dimensions.",
fSizes->
GetSize());
903 Warning(
"ReadAsImage",
"layer out of bounds.");
928 if (!
im)
return nullptr;
945 if (
pal ==
nullptr) {
948 for (i = 0; i < 256; i++) {
950 pal->fColorAlpha[i] = 0xffff;
951 pal->fColorBlue[i] =
pal->fColorGreen[i] =
pal->fColorRed[i] = i << 8;
954 pal->fPoints[255] = 1.0;
976 Warning(
"Draw",
"cannot draw. This is not an image HDU.");
1003 Warning(
"ReadAsMatrix",
"this is not an image HDU.");
1008 Warning(
"ReadAsMatrix",
"could not convert image HDU to image because it has %d dimensions.",
fSizes->
GetSize());
1015 Warning(
"ReadAsMatrix",
"layer out of bounds.");
1033 if ((opt[0] ==
'S') || (opt[0] ==
's')) {
1096 Warning(
"ReadAsHistogram",
"this is not an image HDU.");
1103 Warning(
"ReadAsHistogram",
"could not convert image HDU to histogram because it has %d dimensions.",
fSizes->
GetSize());
1114 for (
x = 0;
x <
Nx;
x++) {
1130 for (
y = 0;
y <
Ny;
y++) {
1132 for (
x = 0;
x <
Nx;
x++) {
1148 TH3D *
h =
new TH3D(
"",
"",
Int_t(
Nx), 0,
Nx-1,
Int_t(
Ny), 0,
Ny-1,
Int_t(
Nz), 0,
Nz-1);
1151 for (z = 0; z <
Nz; z++) {
1153 for (
y = 0;
y <
Ny;
y++) {
1155 for (
x = 0;
x <
Nx;
x++) {
1175 Warning(
"GetArrayRow",
"this is not an image HDU.");
1180 Warning(
"GetArrayRow",
"could not get row from HDU because it has %d dimensions.",
fSizes->
GetSize());
1191 Warning(
"GetArrayRow",
"index out of bounds.");
1196 double *
v =
new double[
W];
1198 for (i = 0; i <
W; i++) {
1215 Warning(
"GetArrayColumn",
"this is not an image HDU.");
1220 Warning(
"GetArrayColumn",
"could not get row from HDU because it has %d dimensions.",
fSizes->
GetSize());
1231 Warning(
"GetArrayColumn",
"index out of bounds.");
1235 double *
v =
new double[
H];
1237 for (i = 0; i <
H; i++) {
1269 Warning(
"GetTabStringColumn",
"this is not a table HDU.");
1274 Warning(
"GetTabStringColumn",
"column index out of bounds.");
1279 Warning(
"GetTabStringColumn",
"attempting to read a column that is not of type 'kString'.");
1299 Warning(
"GetTabStringColumn",
"this is not a table HDU.");
1307 Warning(
"GetTabStringColumn",
"column not found.");
1312 Warning(
"GetTabStringColumn",
"attempting to read a column that is not of type 'kString'.");
1332 Warning(
"GetTabRealVectorColumn",
"this is not a table HDU.");
1337 Warning(
"GetTabRealVectorColumn",
"column index out of bounds.");
1342 Warning(
"GetTabRealVectorColumn",
"attempting to read a column whose cells have embedded fixed-length arrays");
1343 Info(
"GetTabRealVectorColumn",
"Use GetTabRealVectorCells() or GetTabRealVectorCell() instead.");
1346 Warning(
"GetTabRealVectorColumn",
"attempting to read a column whose cells have embedded variable-length arrays");
1347 Info(
"GetTabRealVectorColumn",
"Use GetTabVarLengthCell() instead.");
1371 Warning(
"GetTabRealVectorColumn",
"this is not a table HDU.");
1378 Warning(
"GetTabRealVectorColumn",
"column not found.");
1383 Warning(
"GetTabRealVectorColumn",
"attempting to read a column whose cells have embedded fixed-length arrays");
1384 Info(
"GetTabRealVectorColumn",
"Use GetTabRealVectorCells() or GetTabRealVectorCell() instead.");
1387 Warning(
"GetTabRealVectorColumn",
"attempting to read a column whose cells have embedded variable-length arrays");
1388 Info(
"GetTabRealVectorColumn",
"Use GetTabVarLengthCell() instead.");
1424 Warning(
"Change",
"error changing HDU. Restoring the previous one...");
1430 Warning(
"Change",
"could not restore previous HDU. This object is no longer reliable!!");
1457 Warning(
"GetTabRealVectorCells",
"this is not a table HDU.");
1462 Warning(
"GetTabRealVectorCells",
"column index out of bounds.");
1467 Warning(
"GetTabRealVectorCells",
"attempting to read a column whose cells have embedded variable-length arrays");
1468 Info(
"GetTabRealVectorCells",
"Use GetTabVarLengthCell() instead.");
1496 Warning(
"GetTabRealVectorCells",
"this is not a table HDU.");
1503 Warning(
"GetTabRealVectorCells",
"column not found.");
1516 Warning(
"GetTabRealVectorCell",
"this is not a table HDU.");
1521 Warning(
"GetTabRealVectorCell",
"column index out of bounds.");
1526 Warning(
"GetTabRealVectorCell",
"row index out of bounds.");
1531 Warning(
"GetTabRealVectorCells",
"attempting to read a column whose cells have embedded variable-length arrays");
1532 Info(
"GetTabRealVectorCells",
"Use GetTabVarLengthCell() instead.");
1547 Warning(
"GetTabRealVectorCell",
"this is not a table HDU.");
1554 Warning(
"GetTabRealVectorCell",
"column not found.");
1569 Error(
"GetColumnName",
"this is not a table HDU.");
1574 Error(
"GetColumnName",
"column index out of bounds.");
1586 Warning(
"GetTabVarLengthVectorCell",
"this is not a table HDU.");
1591 Warning(
"GetTabVarLengthVectorCell",
"column index out of bounds.");
1596 Warning(
"GetTabVarLengthVectorCell",
"row index out of bounds.");
1609 Warning(
"GetTabVarLengthVectorCell",
"this is not a table HDU.");
1616 Warning(
"GetTabVarLengthVectorCell",
"column not found.");
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char cname
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
TMatrixT< Double_t > TMatrixD
TVectorT< Double_t > TVectorD
Array of doubles (64 bits per element).
Double_t GetAt(Int_t i) const override
Array of integers (32 bits per element).
Double_t GetAt(Int_t i) const override
void SetAt(Double_t v, Int_t i) override
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
FITS file interface class.
union Cell * fCells
Table cells (when fType == kTableHDU).
void PrintColumnInfo(const Option_t *) const
Print column information.
void _initialize_me()
Do some initializations.
void PrintFullTable(const Option_t *) const
Print full table contents.
TString & GetKeywordValue(const char *keyword)
Get the value of a given keyword. Return "" if not found.
Int_t fNRows
Number of rows (when fType == kTableHDU)
const TString & GetColumnName(Int_t colnum)
Get the name of a column given its index (column>=0).
Int_t fNRecords
Number of records.
TString fFilePath
Path to HDU's file including filter.
struct Column * fColumnsInfo
Information about columns (when fType == kTableHDU)
TFITSHDU(const char *filepath_with_filter)
TFITSHDU constructor from file path with HDU selection filter.
Int_t fNColumns
Number of columns (when fType == kTableHDU)
TVectorD * GetTabRealVectorColumn(Int_t colnum)
Get a real number-typed column from a table HDU given its column index (>=0).
~TFITSHDU() override
TFITSHDU destructor.
TArrayI * fSizes
Image sizes in each dimension (when fType == kImageHDU)
TImage * ReadAsImage(Int_t layer=0, TImagePalette *pal=nullptr)
Read image HDU as a displayable image.
Bool_t Change(const char *filter)
Change to another HDU given by "filter".
TMatrixD * ReadAsMatrix(Int_t layer=0, Option_t *opt="")
Read image HDU as a matrix.
Int_t fNumber
HDU number (1=PRIMARY)
void PrintHDUMetadata(const Option_t *opt="") const
Print records.
struct HDURecord * fRecords
HDU metadata records.
TVectorD * GetArrayRow(UInt_t row)
Get a row from the image HDU when it's a 2D array.
void Draw(Option_t *opt="") override
If the HDU is an image, draw the first layer of the primary array To set a title to the canvas,...
void _release_resources()
Release internal resources.
void PrintFileMetadata(const Option_t *opt="") const
Print HDU's parent file's metadata.
static void CleanFilePath(const char *filepath_with_filter, TString &dst)
Clean path from possible filter and put the result in 'dst'.
struct HDURecord * GetRecord(const char *keyword)
Get record by keyword.
void Print(const Option_t *opt="") const override
Print metadata.
TObjArray * GetTabStringColumn(Int_t colnum)
Get a string-typed column from a table HDU given its column index (>=0).
TString fBaseFilePath
Path to HDU's file excluding filter.
TH1 * ReadAsHistogram()
Read image HDU as a histogram.
TObjArray * GetTabRealVectorCells(Int_t colnum)
Get a collection of real vectors embedded in cells along a given column from a table HDU....
TArrayD * fPixels
Image pixels (when fType == kImageHDU)
TVectorD * GetArrayColumn(UInt_t col)
Get a column from the image HDU when it's a 2D array.
enum EHDUTypes fType
HDU type.
TVectorD * GetTabRealVectorCell(Int_t rownum, Int_t colnum)
Get a real array (with fixed or variable-length) embedded in a cell given by (row>=0,...
Bool_t LoadHDU(TString &filepath_filter)
Load HDU from fits file satisfying the specified filter.
TString fExtensionName
Extension Name.
TArrayD * GetTabVarLengthVectorCell(Int_t rownum, Int_t colnum)
Get the variable-length array contained in a cell given by (row>=0, column name)
Int_t GetColumnNumber(const char *colname)
Get column number given its name.
1-D histogram with a double per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
2-D histogram with a double per channel (see TH1 documentation)
3-D histogram with a double per channel (see TH1 documentation)
A class to define a conversion from pixel values to pixel color.
An abstract interface to image processing library.
static TImage * Create()
Create an image.
const char * GetName() const override
Returns name of object.
void Add(TObject *obj) override
Collectable string class.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
const char * Data() const
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
TVectorT< Element > & Use(Int_t lwb, Int_t upb, Element *data)
Use the array data to fill the vector lwb..upb].
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.