244 if (status)
goto ERR;
254 if (status)
goto ERR;
264 if (status)
goto ERR;
268 for (
int i = 1; i <=
nkeys; i++) {
270 if (status)
goto ERR;
280 for (
int i = 0; i <
nkeys; i++) {
281 if (
fRecords[i].fKeyword ==
"EXTNAME") {
289 Info(
"LoadHDU",
"The selected HDU contains an Image Extension");
296 if (status)
goto ERR;
347 Info(
"LoadHDU",
"The selected HDU contains a Table Extension");
354 if (status)
goto ERR;
359 if (status)
goto ERR;
391 if (status)
goto ERR;
403 if (status)
goto ERR;
406 char *
nulval = (
char*)
"";
423 delete [] array[row];
451 double *array =
nullptr;
488 int temp = (
signed char)
arrayl[row];
567 std::vector<short>
data;
570 for (
int i = 0; i <
size; i++)
573 std::vector<int>
data;
576 for (
int i = 0; i <
size; i++)
579 std::vector<float>
data;
582 for (
int i = 0; i <
size; i++)
585 std::vector<double>
data;
588 for (
int i = 0; i <
size; i++)
591 Error(
"LoadHDU",
"The variable-length array type in column %d is unknown",
colnum + 1);
597 Warning(
"LoadHDU",
"error opening FITS file. Column type %d is currently not supported",
typecode);
653 if (
fRecords[i].fComment.Length() > 0) {
673 int verbose = (opt[0] ? 1 : 0);
677 if (status)
goto ERR;
681 if (status)
goto ERR;
688 if (status)
goto ERR;
705 if (status)
goto ERR;
709 for (
int i = 1; i <=
nkeys; i++) {
718 records[i-1].fComment = comment;
731 for (
int i = 0; i <
nkeys; i++) {
747 if (status)
goto ERR;
757 Warning(
"PrintFileMetadata",
"error opening FITS file. Details: %s",
errdescr);
768 Warning(
"PrintColumnInfo",
"this is not a table HDU.");
798 Warning(
"PrintColumnInfo",
"this is not a table HDU.");
806 Warning(
"PrintColumnInfo",
"The table contains column with fixed-length arrays and cannot be flattened for printing.");
810 Warning(
"PrintColumnInfo",
"The table contains column with variable-length arrays and cannot be flattened for printing.");
859 if ((opt[0] ==
'F') || (opt[0] ==
'f')) {
861 }
else if ((opt[0] ==
'T') || (opt[0] ==
't')) {
882 Warning(
"ReadAsImage",
"this is not an image HDU.");
887 Warning(
"ReadAsImage",
"could not convert image HDU to image because it has %d dimensions.",
fSizes->
GetSize());
902 Warning(
"ReadAsImage",
"layer out of bounds.");
927 if (!
im)
return nullptr;
944 if (
pal ==
nullptr) {
947 for (i = 0; i < 256; i++) {
949 pal->fColorAlpha[i] = 0xffff;
950 pal->fColorBlue[i] =
pal->fColorGreen[i] =
pal->fColorRed[i] = i << 8;
953 pal->fPoints[255] = 1.0;
975 Warning(
"Draw",
"cannot draw. This is not an image HDU.");
1002 Warning(
"ReadAsMatrix",
"this is not an image HDU.");
1007 Warning(
"ReadAsMatrix",
"could not convert image HDU to image because it has %d dimensions.",
fSizes->
GetSize());
1014 Warning(
"ReadAsMatrix",
"layer out of bounds.");
1032 if ((opt[0] ==
'S') || (opt[0] ==
's')) {
1095 Warning(
"ReadAsHistogram",
"this is not an image HDU.");
1102 Warning(
"ReadAsHistogram",
"could not convert image HDU to histogram because it has %d dimensions.",
fSizes->
GetSize());
1113 for (
x = 0;
x <
Nx;
x++) {
1129 for (
y = 0;
y <
Ny;
y++) {
1131 for (
x = 0;
x <
Nx;
x++) {
1147 TH3D *
h =
new TH3D(
"",
"",
Int_t(
Nx), 0,
Nx-1,
Int_t(
Ny), 0,
Ny-1,
Int_t(
Nz), 0,
Nz-1);
1150 for (z = 0; z <
Nz; z++) {
1152 for (
y = 0;
y <
Ny;
y++) {
1154 for (
x = 0;
x <
Nx;
x++) {
1174 Warning(
"GetArrayRow",
"this is not an image HDU.");
1179 Warning(
"GetArrayRow",
"could not get row from HDU because it has %d dimensions.",
fSizes->
GetSize());
1190 Warning(
"GetArrayRow",
"index out of bounds.");
1195 double *
v =
new double[
W];
1197 for (i = 0; i <
W; i++) {
1214 Warning(
"GetArrayColumn",
"this is not an image HDU.");
1219 Warning(
"GetArrayColumn",
"could not get row from HDU because it has %d dimensions.",
fSizes->
GetSize());
1230 Warning(
"GetArrayColumn",
"index out of bounds.");
1234 double *
v =
new double[
H];
1236 for (i = 0; i <
H; i++) {
1268 Warning(
"GetTabStringColumn",
"this is not a table HDU.");
1273 Warning(
"GetTabStringColumn",
"column index out of bounds.");
1278 Warning(
"GetTabStringColumn",
"attempting to read a column that is not of type 'kString'.");
1298 Warning(
"GetTabStringColumn",
"this is not a table HDU.");
1306 Warning(
"GetTabStringColumn",
"column not found.");
1311 Warning(
"GetTabStringColumn",
"attempting to read a column that is not of type 'kString'.");
1331 Warning(
"GetTabRealVectorColumn",
"this is not a table HDU.");
1336 Warning(
"GetTabRealVectorColumn",
"column index out of bounds.");
1341 Warning(
"GetTabRealVectorColumn",
"attempting to read a column whose cells have embedded fixed-length arrays");
1342 Info(
"GetTabRealVectorColumn",
"Use GetTabRealVectorCells() or GetTabRealVectorCell() instead.");
1345 Warning(
"GetTabRealVectorColumn",
"attempting to read a column whose cells have embedded variable-length arrays");
1346 Info(
"GetTabRealVectorColumn",
"Use GetTabVarLengthCell() instead.");
1370 Warning(
"GetTabRealVectorColumn",
"this is not a table HDU.");
1377 Warning(
"GetTabRealVectorColumn",
"column not found.");
1382 Warning(
"GetTabRealVectorColumn",
"attempting to read a column whose cells have embedded fixed-length arrays");
1383 Info(
"GetTabRealVectorColumn",
"Use GetTabRealVectorCells() or GetTabRealVectorCell() instead.");
1386 Warning(
"GetTabRealVectorColumn",
"attempting to read a column whose cells have embedded variable-length arrays");
1387 Info(
"GetTabRealVectorColumn",
"Use GetTabVarLengthCell() instead.");
1423 Warning(
"Change",
"error changing HDU. Restoring the previous one...");
1429 Warning(
"Change",
"could not restore previous HDU. This object is no longer reliable!!");
1456 Warning(
"GetTabRealVectorCells",
"this is not a table HDU.");
1461 Warning(
"GetTabRealVectorCells",
"column index out of bounds.");
1466 Warning(
"GetTabRealVectorCells",
"attempting to read a column whose cells have embedded variable-length arrays");
1467 Info(
"GetTabRealVectorCells",
"Use GetTabVarLengthCell() instead.");
1495 Warning(
"GetTabRealVectorCells",
"this is not a table HDU.");
1502 Warning(
"GetTabRealVectorCells",
"column not found.");
1515 Warning(
"GetTabRealVectorCell",
"this is not a table HDU.");
1520 Warning(
"GetTabRealVectorCell",
"column index out of bounds.");
1525 Warning(
"GetTabRealVectorCell",
"row index out of bounds.");
1530 Warning(
"GetTabRealVectorCells",
"attempting to read a column whose cells have embedded variable-length arrays");
1531 Info(
"GetTabRealVectorCells",
"Use GetTabVarLengthCell() instead.");
1546 Warning(
"GetTabRealVectorCell",
"this is not a table HDU.");
1553 Warning(
"GetTabRealVectorCell",
"column not found.");
1568 Error(
"GetColumnName",
"this is not a table HDU.");
1573 Error(
"GetColumnName",
"column index out of bounds.");
1585 Warning(
"GetTabVarLengthVectorCell",
"this is not a table HDU.");
1590 Warning(
"GetTabVarLengthVectorCell",
"column index out of bounds.");
1595 Warning(
"GetTabVarLengthVectorCell",
"row index out of bounds.");
1608 Warning(
"GetTabVarLengthVectorCell",
"this is not a table HDU.");
1615 Warning(
"GetTabVarLengthVectorCell",
"column not found.");
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int)
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
double Double_t
Double 8 bytes.
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
const char Option_t
Option string (const char)
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 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 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 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.
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.