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