File: testimg.p

package info (click to toggle)
pdl 2.005-4
  • links: PTS
  • area: main
  • in suites: potato
  • size: 4,200 kB
  • ctags: 3,301
  • sloc: perl: 14,876; ansic: 7,223; fortran: 3,417; makefile: 54; sh: 16
file content (30 lines) | stat: -rw-r--r-- 685 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use blib;
use Carp;

$SIG{__DIE__} = sub {die Carp::longmess(@_);};

use PDL;
use PDL::Graphics::TriD;
use PDL::Graphics::TriD::Image;
use PDL::IO::Pic;

$PDL::Graphics::TriD::verbose=0;

$win = PDL::Graphics::TriD::get_current_window();
$vp = $win->new_viewport(0,0,1,1);

# Here we show an 8-dimensional (!!!!!) RGB image to test Image.pm

$r = zeroes(4,5,6,7,2,2,2,2)+0.1;
$g = zeroes(4,5,6,7,2,2,2,2);
$b = zeroes(4,5,6,7,2,2,2,2);

($tmp = $r->slice(":,:,2,2")) .= 1;
($tmp = $r->slice(":,:,:,1")) .= 0.5;
($tmp = $g->slice("2,:,1,2")) .= 1;
($tmp = $b->slice("2,3,1,:")) .= 1;

$vp->clear_objects();
$vp->add_object(new PDL::Graphics::TriD::Image([$r,$g,$b]));
$win->twiddle();