Logo ROOT  
Reference Guide
FITS_tutorial3.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_FITS
3/// \notebook -draw
4/// Open a FITS file and retrieve the first plane of the image array
5/// as a TImage object.
6///
7/// \macro_image
8/// \macro_code
9/// \macro_output
10///
11/// \author Claudi Martinez
12
13void FITS_tutorial3()
14{
15 // We open a FITS file that contains several image
16 // extensions. The primary HDU contains no data.
17 // Data copyright: NASA
18
19 // Open extensions 1 to 5 from file
20 TString dir = gROOT->GetTutorialDir();
21
22 auto c = new TCanvas("c1", "FITS tutorial #1", 800, 700);
23 c->Divide(2, 3);
24 for (auto i : ROOT::TSeqI(1, 6)) {
25 TFITSHDU hdu(dir + "/fitsio/sample3.fits", i);
26
27 TImage* im = (TImage *)hdu.ReadAsImage(0);
28 c->cd(i);
29 im->Draw();
30 }
31}
#define c(i)
Definition: RSha256.hxx:101
#define gROOT
Definition: TROOT.h:404
A pseudo container class which is a generator of indices.
Definition: TSeq.hxx:66
The Canvas class.
Definition: TCanvas.h:23
FITS file interface class.
Definition: TFITS.h:35
An abstract interface to image processing library.
Definition: TImage.h:29
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:197
Basic string class.
Definition: TString.h:136