Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
galaxy_image.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_image
3/// \notebook
4/// Importing an image and manipulating it.
5///
6/// \image html image_galaxy_image.png
7/// \macro_code
8///
9/// \author Valeriy Onuchin
10
11void galaxy_image()
12{
13 TCanvas *canv = new TCanvas("image", "n4254", 40, 40, 812, 700);
14 canv->ToggleEventStatus();
15 canv->SetRightMargin(0.2);
16 canv->SetLeftMargin(0.01);
17 canv->SetTopMargin(0.01);
18 canv->SetBottomMargin(0.01);
19
20 // read the pixel data from file "galaxy.root"
21 // the size of the image is 401 X 401 pixels
22 const char *fname = "galaxy.root";
23 TFile *gal = 0;
26 } else {
27 printf("accessing %s file from http://root.cern/files\n",fname);
28 gal = TFile::Open(Form("http://root.cern/files/%s",fname));
29 }
30 if (!gal) return;
31 TImage *img = (TImage*)gal->Get("n4254");
32 img->Draw();
33
34 // open the color editor
35 img->StartPaletteEditor();
36
37 // zoom the image
38 img->Zoom(80, 80, 250, 250);
39}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2489
R__EXTERN TSystem * gSystem
Definition TSystem.h:572
The Canvas class.
Definition TCanvas.h:23
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Definition TFile.h:53
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
Definition TFile.cxx:4094
An abstract interface to image processing library.
Definition TImage.h:29
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Definition TSystem.cxx:1296