Christian Soeller > PDL-2.4.3 > PDL::Graphics::Karma


Annotate this POD


Open  0
View/Report Bugs


PDL::Graphics::Karma - interface to Karma visualisation applications


Can send PDL 2D/3D data to kview, xray, kslice_3d, etc...

Data is transferred using shared memory when available on the OS (and segments big enough - e.g. Linux but not Solaris unless tuned) so ought to be very fast.

You can say

  perldl> kim $a, {App=>'xray'}

to send to a specific viewer and/or

  perldl> kim $a, {BB=>[0,50,-100,100]}

to specify the bounding box in world coordinates (here for a 2D image) or just

  perldl> kim $a

to reuse the last viewer.

You can start the viewers from PDL.

For further info about Karma see The binary distribution can be downloaded from


 use PDL::Karma;
 kim $data;



Sends piddle data array to an external Karma application for viewing

 kim($pdl, [$karma-app, $lut])

Sends $pdl data to Karma application viewer. Remembers the last one used [default: kview].



Tests if a Karma application is running.

It tries to connect to the karma application, returns 1 on success, 0 otherwise

Can be used to check if a karma application has already been started, e.g.

  xray unless kstarted 'xray';


krgb($lut, [$karma-app])

Sends RGB image to an external Karma application for viewing

Does not change current default viewer.


Starts external Karma application $app


 perldl> kview (-num_col => 42)
 perldl> xray


Overlay graphics markers on a Karma application (e.g. kview)

koverlay $x, $y, {Options...}

Currently the only markers supported are ellipses. The default is a circle of radius 10 units,

$x = 10*xvals(10); koverlay $x, sqrt($x), {Radius=>$x/3, Colour=>'green', App=>'kpolar'}

  Radius - [piddle] specify radius of ellipses (major axis if ellipse). Default = 10 units.
  Ellip  - [piddle] specify ellipticity of ellipses. Default = 0 i.e. circle.
  PA     - [piddle] specify principle axis (degrees rotation anticlockwise
                    from the Y axis). Default.
  ID     - [piddle] Numeric integer id labels to apply.
  Colour - [string] Colour name for overlay (e.g.  'red'). Default = 'blue'
  App    - [string] name of Karma app to send too
  Fill   - [piddle] whether outlines are filled (0 or 1). (Note filled,
                    ellipses are not yet available in Karma).
  Coords - [string] "World" or "Pixel" - type of coordinates for x/y/r.
                    Note pixel implementation rounds to nearest pixel due
                    to Karma overlays not supporting proper IMAGE_PIXEL


Return cursor position from a Karma application (e.g. kview/xray)

 ($x,$y) = kcur($ch, {App=>'karma-app',Coords=>"World|Pixel"})

This function connects to a Karma application and returns the ($x,$y) position and the character typed ($ch) by the user. By default world coordinates are returned.

  print kcur {App=>"kview", Coords=>"World"}


Copyright (C) 1997-2001 Christian Soeller, Karl Glazebrook. Reproducing documentation from the pdl distribution in any way that does not include a statement telling who the original authors are is forbidden. Reproducing and/or distributing the documentation in any form that alters the text is forbidden. This module is free software and can be distributed under the same terms as PDL itself.

syntax highlighting: