galaxy_image.C

Go to the documentation of this file.
00001 //Importing an image and manipulating it
00002 //Author: Valeriy Onuchin
00003    
00004 void galaxy_image()
00005 {
00006    TCanvas *canv = new TCanvas("image", "n4254", 40, 40, 812, 700);
00007    canv->ToggleEventStatus();
00008    canv->SetRightMargin(0.2);
00009    canv->SetLeftMargin(0.01);
00010    canv->SetTopMargin(0.01);
00011    canv->SetBottomMargin(0.01);
00012 
00013    // read the pixel data from file "galaxy.root"
00014    // the size of the image is 401 X 401 pixels
00015    const char *fname = "galaxy.root";
00016    TFile *gal = 0;
00017    if (!gSystem->AccessPathName(fname)) {
00018       gal = TFile::Open(fname);
00019    } else {
00020       printf("accessing %s file from http://root.cern.ch/files\n",fname);
00021       gal = TFile::Open(Form("http://root.cern.ch/files/%s",fname));
00022    }
00023    if (!gal) return;
00024    TImage *img = (TImage*)gal->Get("n4254");
00025    img->Draw();
00026 
00027    // open the color editor
00028    img->StartPaletteEditor();
00029 
00030    // zoom the image
00031    img->Zoom(80, 80, 250, 250);
00032 }

Generated on Tue Jul 5 15:44:48 2011 for ROOT_528-00b_version by  doxygen 1.5.1