FITS_tutorial3.C

Go to the documentation of this file.
00001 // Open a FITS file and retrieve the first plane of the image array 
00002 // as a TASImage object
00003 void FITS_tutorial3()
00004 {
00005    printf("\n\n--------------------------------\n");
00006    printf("WELCOME TO FITS tutorial #3 !!!!\n");
00007    printf("--------------------------------\n");
00008    printf("We're gonna open a FITS file that contains several image\n");
00009    printf("extensions. The primary HDU contains no data.\n");
00010    printf("Data copyright: NASA\n\n");
00011    
00012    if (!gROOT->IsBatch()) {
00013       //printf("Press ENTER to start..."); getchar();
00014    }
00015    
00016    // Open extensions 1 to 5 from file
00017    //printf("Press ENTER to see a canvas with all images within the file:"); getchar();
00018    
00019    TCanvas *c = new TCanvas("c1", "FITS tutorial #1", 800, 700);
00020    c->Divide(2,3);
00021    for (int i=1; i <= 5; i++) {
00022       TFITSHDU *hdu = new TFITSHDU("sample3.fits", i);
00023       if (hdu == 0) {
00024          printf("ERROR: could not access the HDU\n"); return;
00025       }
00026       
00027       TASImage *im = hdu->ReadAsImage(0);
00028       c->cd(i);
00029       im->Draw();
00030       delete hdu;
00031    }
00032 }
00033 
00034  

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