Dear Guillermo,

there are a number of ways you can create your images from the N-image stack.

If you want a series of individual images, you could do something like this

for (my $ii (0..$imn->dim(3)-1)) { $im(,,,$ii;-)->wpic("image_$ii.png"); }

If you want to combine the stack, a mip can be created by

$imn->reduce('maximum',3);

or

$imn->mv(3,0)->maximum;

You can do 'average','medover','sumover', etc. instead of 'maximum', depending on what you want. There are many aggregate functions available.

I hope this helps.

Best,

Ingo

On 24.10.24 5:52 PM, Guillermo P. Ortiz wrote:
Hello again, thanks to Ed for show me a typo error
in my example. Where I wrote

$im=$imn->reduce('op',2);

it must say

$im=$imn->reduce('op',3);

But, the question remain in how to do an 'op' that
result in a sorted overlapping between all the sub images

In other words. Suppose you have n=0 sub image with
a red circle and in n=1 a sub image with a blue rectangle.
Some pixeles of both images are in common.
Then, what I want is to get a composed image that shows
the red circle overlapping the blue rectangle. The same
idea for many subimages with sorted overlapping.

Regards,











El jue, 24 oct 2024 a las 9:57, Guillermo P. Ortiz (<gor...@exa.unne.edu.ar>) escribió:

    Hello Ed,
    thanks for your reply.
    That I trying to mean with 'reduce' is some of
    projection operation (op) like in PDL::Reduce module
    that performs "(op)over" to reduce to N-1
    dimension after some operation over the set of
    (3,x,y, n) to (3,x,y) rgb images. I mean
    a composed rgb image from a set of (layer) n rgb images.
    For example:

    $imn-> info : pdl D [3,nx,ny,n]
    $im=$imn->reduce('op',2);
    $im-> info : pdl D [3,nx,ny]

    Then, maybe I need to introduce some "sort"
    operation in order that when I reduce to one
    composed $im image each layer in $imn overlap
    the following layer. But, I did not realize how to do that
    using some pdl trick.

    Thanks a lot for your help

    Regards



    El jue, 24 oct 2024 a las 9:12, Ed . (<ej...@hotmail.com>) escribió:

        Hi Guillermo,

        I believe the situation you're describing is you have
        effectively a series of (3,x,y) images.  You mention
        "reducing", but you haven't said what you mean by that - would
        it turn that series of images into one image?

        wpic is intended to write out a single image, so an ndarray
        with multiple images won't work with that. To write out a
        series of images as a movie you could use wmpeg, or just to
        store the data you could use
        https://metacpan.org/pod/PDL::IO::FastRaw and specifically
        writefraw. Otherwise to write each image in its own file you
        could use something like:

          $_->wpic(sprintf "img%03d.png", $count++) for $pdl->dog;

        Does that help?

        Best regards,
        Ed
        ------------------------------------------------------------------------
        *From:* Guillermo P. Ortiz <gor...@exa.unne.edu.ar>
        *Sent:* 23 October 2024 4:42 PM
        *To:* pdl-devel@lists.sourceforge.net
        <pdl-devel@lists.sourceforge.net>;
        pdl-gene...@lists.sourceforge.net
        <pdl-gene...@lists.sourceforge.net>
        *Subject:* [Pdl-devel] project ordered sequence image
        Hello everyone,

        I have created a pdl with structure (3,size_x,size_y,np)
        in order to manage different layer features to compose an rgb
        image.

        The idea that I can not connect yet is how to "reduce" over dim 3
        to project to 3 X s_x X s_y rgb image in ordered fashion
        sequence. For example,
        suppose that for np=0, 1 and 2, in the resulting image is only
        view of 2 that
        is allowed by 1 and 0 layers, in that order.

        I am trying to use wpic command from PDL::IO::Pic module
        to convert via for example pnmtopng using options for it.
        There are hashes like {FLAGS => options} used for options
        {CONVERTER => 'pnmtopng'} indicating which conversor to use.
        But is seems to be intended of rgb 3(4) X s_x X s_y

        Thanks for your attention in advance

        Regards


--

        Dr. Guillermo P. Ortiz
        Electromagnetismo Aplicado
        Dto. Física, Facultad de Ciencias Exactas
        Universidad Nacional del Nordeste
        Avda Libertad 5460, Campus UNNE.
        W3404AAS Corrientes, Argentina.
        (+54) 379-4424678 interno 4613
        gortiz*at *unne edu ar



_______________________________________________
pdl-devel mailing list
pdl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-devel
_______________________________________________
pdl-devel mailing list
pdl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-devel

Reply via email to