Re: misc

Valery Fine (Valeri.Faine@cern.ch)
Fri, 28 Feb 1997 19:43:48 +0100


On 28 Feb 97 at 18:55, Jens Racky [ET] wrote:

> I've got some questions concerning the visualization facilities of
> ROOT (Linux2 version with Motif2.0). First, if a canvas was
> overlapped by another window or popup, I have to click on it or
> enter a newline in the command window to have it repaint itself. How
> can I make it repainting automatically ?
>

Updating of the canvas is forsed via TCanvas::Update() member
function (see "tutorials/canvas.C" macro). It is called after each
<CR> and with some events. I hope our LINUX expert will provide a
further information.

> Second (and much more important),: How can I use the 2D histogram
> class to display arrays (i.e. gray scale images)? I tried this using
> the Fill() function, but this is VERY slow. Any way to acess the
> memory area holding the histogram data directly, or is there a way
> to visualize "arrays" directly?

I'd investigated this possibility and even wrote a code to convert
any raster image to ROOT 2d histogram and concluded it is no use
because of speed. It proved it is possible in theory and does need a
separate implementation.

Anyway TH1<x> class is derived from the TArray<x> class and it is
a clue. I think the TImage class must be derived from the TArray
class directly.

ROOT histogram classes are optimized for the histograms only.

> Can the lookup table be changed
> easily (i.e. to apply different colormaps like a spread of gray
> values, pseudo color, etc.)?

ROOT has a single lookup table and it can be changed (see piece of
code below). But one has to take in account that it affects all pads
and canvases simutaneously. That was optimized for histogram as well.

> Is there a possibility to transparently
> layer (superimpose)graphical areas (i.e. by marking a color as translucent)?

Well It is possible but was not implemented yet.

Something can be found via TROOT class. See for instance how it is
used to plot 3d surfaces. But I didn't advice to use it since it
change the color globally for all pad and can

//_______________________________
void TH1::PaintSurface() {

....... .......

//*-*- Gouraud Shading surface
if (Hoption.Surf == 14) {
//*-* Set light sources
gLego->LightSource(0, ydiff, 0,0,0,irep);
gLego->LightSource(1, yligh1 ,1,1,1,irep);
gLego->SurfaceProperty(qa, qd, qs, 1, irep);
fmin = ydiff*qa;
fmax = fmin + (yligh1+0.1)*(qd+qs);
Int_t nbcol = 28;
icol1 = 201;
Float_t dcol = 0.5/Float_t(nbcol);
TColor *colref = gROOT->GetColor(GetFillColor());
Float_t r,g,b,hue,light,satur;
colref->GetRGB(r,g,b);
colref->RGBtoHLS(r,g,b,hue,light,satur);
TColor *acol;
for (Int_t col=0;col<nbcol;col++) {
acol = gROOT->GetColor(col+icol1);
acol->HLStoRGB(hue,.4+col*dcol,satur,r,g,b);
acol->SetRGB(r,g,b);
}

Hope this helps.

Valery
=================================================================
Dr. Valery Fine Telex : 911621 dubna su
-----------
LCTA/Joint Inst.for NuclearRes Phone : +7 09621 6 40 80
141980 Dubna, Moscow region Fax : +7 09621 6 51 45
Russia mailto:fine@main1.jinr.dubna.su
mailto:fine@vxcern.cern.ch
Dr. Valeri Faine
------------ Phone: +41 22 767 6468
CERN FAX : +41 22 782 2601
CH-1211 Geneva, 23 mailto:fine@vxcern.cern.ch
Switzerland http://nicewww.cern.ch/~fine