{ "cells": [ { "cell_type": "markdown", "id": "afbc17f0", "metadata": {}, "source": [ "# galaxy_image\n", "Importing an image and manipulating it.\n", "\n", "\n", "\n", "\n", "**Author:** Valeriy Onuchin \n", "This notebook tutorial was automatically generated with ROOTBOOK-izer from the macro found in the ROOT repository on Tuesday, May 19, 2026 at 08:38 PM." ] }, { "cell_type": "code", "execution_count": 1, "id": "ca69ba79", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:38:35.191507Z", "iopub.status.busy": "2026-05-19T20:38:35.191402Z", "iopub.status.idle": "2026-05-19T20:38:35.539678Z", "shell.execute_reply": "2026-05-19T20:38:35.539158Z" } }, "outputs": [], "source": [ "TCanvas *canv = new TCanvas(\"image\", \"n4254\", 40, 40, 812, 700);\n", "canv->ToggleEventStatus();\n", "canv->SetRightMargin(0.2);\n", "canv->SetLeftMargin(0.01);\n", "canv->SetTopMargin(0.01);\n", "canv->SetBottomMargin(0.01);" ] }, { "cell_type": "markdown", "id": "99055812", "metadata": {}, "source": [ "read the pixel data from file \"galaxy.root\"\n", "the size of the image is 401 X 401 pixels" ] }, { "cell_type": "code", "execution_count": 2, "id": "feb3f675", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:38:35.541567Z", "iopub.status.busy": "2026-05-19T20:38:35.541451Z", "iopub.status.idle": "2026-05-19T20:38:36.023439Z", "shell.execute_reply": "2026-05-19T20:38:36.023010Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "accessing galaxy.root file from http://root.cern/files\n" ] } ], "source": [ "const char *fname = \"galaxy.root\";\n", "TFile *gal = 0;\n", "if (!gSystem->AccessPathName(fname)) {\n", " gal = TFile::Open(fname);\n", "} else {\n", " printf(\"accessing %s file from http://root.cern/files\\n\", fname);\n", " gal = TFile::Open(Form(\"http://root.cern/files/%s\", fname));\n", "}\n", "if (!gal)\n", " return;\n", "TImage *img = (TImage *)gal->Get(\"n4254\");\n", "img->Draw();" ] }, { "cell_type": "markdown", "id": "28cbf26c", "metadata": {}, "source": [ "open the color editor" ] }, { "cell_type": "markdown", "id": "9ad3aa52", "metadata": {}, "source": [ "zoom the image" ] }, { "cell_type": "code", "execution_count": 3, "id": "fb210d32", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:38:36.025010Z", "iopub.status.busy": "2026-05-19T20:38:36.024900Z", "iopub.status.idle": "2026-05-19T20:38:36.236589Z", "shell.execute_reply": "2026-05-19T20:38:36.236096Z" } }, "outputs": [], "source": [ "img->Zoom(80, 80, 250, 250);" ] }, { "cell_type": "markdown", "id": "8c6a844d", "metadata": {}, "source": [ "Draw all canvases " ] }, { "cell_type": "code", "execution_count": 4, "id": "8762540b", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:38:36.238404Z", "iopub.status.busy": "2026-05-19T20:38:36.238293Z", "iopub.status.idle": "2026-05-19T20:38:36.452204Z", "shell.execute_reply": "2026-05-19T20:38:36.451858Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "
\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "gROOT->GetListOfCanvases()->Draw()" ] } ], "metadata": { "kernelspec": { "display_name": "ROOT C++", "language": "c++", "name": "root" }, "language_info": { "codemirror_mode": "text/x-c++src", "file_extension": ".C", "mimetype": " text/x-c++src", "name": "c++" } }, "nbformat": 4, "nbformat_minor": 5 }