ROOT
6.07/01
Reference Guide
ROOT Home Page
Main Page
Tutorials
User's Classes
Namespaces
All Classes
Files
Release Notes
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
tutorials
image
galaxy_image.C
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_image
3
/// Importing an image and manipulating it.
4
///
5
/// \image html image_galaxy_image.png
6
/// \macro_code
7
///
8
/// \author Valeriy Onuchin
9
10
void
galaxy_image()
11
{
12
TCanvas
*canv =
new
TCanvas
(
"image"
,
"n4254"
, 40, 40, 812, 700);
13
canv->
ToggleEventStatus
();
14
canv->
SetRightMargin
(0.2);
15
canv->
SetLeftMargin
(0.01);
16
canv->
SetTopMargin
(0.01);
17
canv->
SetBottomMargin
(0.01);
18
19
// read the pixel data from file "galaxy.root"
20
// the size of the image is 401 X 401 pixels
21
const
char
*fname =
"galaxy.root"
;
22
TFile
*gal = 0;
23
if
(!
gSystem
->
AccessPathName
(fname)) {
24
gal =
TFile::Open
(fname);
25
}
else
{
26
printf
(
"accessing %s file from http://root.cern.ch/files\n"
,fname);
27
gal =
TFile::Open
(
Form
(
"http://root.cern.ch/files/%s"
,fname));
28
}
29
if
(!gal)
return
;
30
TImage
*img = (
TImage
*)gal->
Get
(
"n4254"
);
31
img->
Draw
();
32
33
// open the color editor
34
img->
StartPaletteEditor
();
35
36
// zoom the image
37
img->
Zoom
(80, 80, 250, 250);
38
}
TSystem::AccessPathName
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:1213
TCanvas::ToggleEventStatus
virtual void ToggleEventStatus()
Toggle event statusbar.
Definition:
TCanvas.cxx:2124
TFile
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition:
TFile.h:45
TDirectoryFile::Get
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
Definition:
TDirectoryFile.cxx:876
TObject::Draw
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition:
TObject.cxx:254
TImage
An abstract interface to image processing library.
Definition:
TImage.h:45
TAttPad::SetTopMargin
virtual void SetTopMargin(Float_t topmargin)
Set Pad top margin in fraction of the pad height.
Definition:
TAttPad.cxx:127
TFile::Open
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
Definition:
TFile.cxx:3851
TAttPad::SetBottomMargin
virtual void SetBottomMargin(Float_t bottommargin)
Set Pad bottom margin in fraction of the pad height.
Definition:
TAttPad.cxx:97
gSystem
R__EXTERN TSystem * gSystem
Definition:
TSystem.h:545
Form
char * Form(const char *fmt,...)
TImage::Zoom
virtual void Zoom(UInt_t, UInt_t, UInt_t, UInt_t)
Definition:
TImage.h:144
TCanvas
The Canvas class.
Definition:
TCanvas.h:48
printf
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
TAttPad::SetRightMargin
virtual void SetRightMargin(Float_t rightmargin)
Set Pad right margin in fraction of the pad width.
Definition:
TAttPad.cxx:117
TAttImage::StartPaletteEditor
virtual void StartPaletteEditor()
Opens a GUI to edit the color palette.
Definition:
TAttImage.cxx:686
TAttPad::SetLeftMargin
virtual void SetLeftMargin(Float_t leftmargin)
Set Pad left margin in fraction of the pad width.
Definition:
TAttPad.cxx:107