in reply to Re^2: PDL questions
in thread PDL questions

i have tried the above error examples on linux mint, just changing the device to /xs instead of /GW:
my $winopt = {Device => "/xs", WindowWidth => 7, Aspect => 1};

and i got the same errors, the first one is
Interface HASH(0X9F05818) is not known!
regards

Replies are listed 'Best First'.
Re^4: PDL questions
by Corion (Patriarch) on Sep 27, 2010 at 14:14 UTC

    Again, you're passing $winopt as the first parameter. $winopt is a hash reference, but PDL::Graphics2D wants an "Interface" (whatever it means by this) as the first parameter, and it tells you that it is unhappy with a hash reference. See the PDL::Graphics2D documentation.

    $win = PDL::Graphics2D->new(<Interface>, <Options>);
Re^4: PDL questions
by BrowserUk (Patriarch) on Sep 27, 2010 at 14:44 UTC

    Looking inside, there is currently only one "interface" defined: 'PGPLOT'. So try passing that as the first argument to new().

Re^4: PDL questions
by Anonymous Monk on Sep 27, 2010 at 21:07 UTC
    i have found some solution, inspired by many posts especially a message with a title "imag2d.pdl for test" :
    http://mailman.jach.hawaii.edu/pipermail/perldl/2009-December/002665.html and
    http://mailman.jach.hawaii.edu/pipermail/perldl/2010-January/002716.html
    we need a file "imag2d.pdl" not in the pdl package, and to use PDL::AutoLoader, as explained in the above message so putting the file imag2d.pdl in the same folder as the following code can run successfully the code with a red dusk like image. i run the code in windows xp activestate perl 5.10
    use PDL; use PGPLOT; use PDL::Graphics2D; #imports imag2d() and twiddle() use PDL::AutoLoader; our @PDLLIB; push @PDLLIB, '.'; my $winopt = {Device => '/GW', WindowWidth => 7, Aspect => 1}; my $w = PDL::Graphics2D->new('PGPLOT'); $a = sequence(64,48,3); # make test RGB image $a = $a->mv(2,0); # color must be dim(0) with size [0..4] $a /= $a->max; # pixel values in [0.0,1.0] $a = sin(10*$a); imag2d($a);

    there may be more improvements, thanks for all
Re^4: PDL questions
by Anonymous Monk on Sep 27, 2010 at 17:36 UTC
    thank you BrowserUk, as always you supply a clear specific answer for the non prof users. i have applied your suggestion
    my $w = PDL::Graphics2D->new('PGPLOT');
    and added also use PGPLOT;
    and yes i can run all the code and display a window like this
    http://img409.imageshack.us/img409/1384/erroriu.png
    but with an error at the final line
    "Can't locate object method "imag2d" via package "PDL" at err.pl line 13"
    this is the same using windows xp and linux mint
    i choose linux mint because it is super easy to install modules directly from their site. and indeed it is the first time i am using linux. also i want to thank zentara for the second version of the "PDL 3d image cube" example in www.perlmonks.org/?node_id=591731
    it is working well rotate and zoom in and out with the mouse.
    regards

      If you want help, you will need to show us the actual code you're running. Also, please don't post screenshots where the simple source code and text output of Perl suffices. That makes it much easier for us to reproduce the problem and thus helps us help you better.

      I suspect that, for some unshown reason, you have something like the following in your code at line 13:

      my $p = sequence(64,48,3); # make test RGB image my $win = $p->imag2d();

      The documentation of PDL::Image2D claims that the usage is not as a method but as a separate function:

      use PDL::Graphics2D; my $p = sequence(64,48,3); # make test RGB image my $win = imag2d( $p );