On 03/18/2014 10:00 AM, Ingo Schmid wrote:
> Chris, yes, but I have problems even if I reset it by calling
> ->sethdr({}), which is strange to me!
To answer my own question, one has to also call ->hdrcopy(0) !Ingo > > I checked again (after a night's sleep), and found that I put the pix=>1 > inside the t_linear, not map call, sorry Craig. That appears to fix it, > thanks! > > Ingo > > On 03/17/2014 09:02 PM, Chris Marshall wrote: >> This may be due to the fact that PDL::Transform is one of the PDL >> modules that uses the PDL hdr to do its job. >> >> --Chris >> >> On Mon, Mar 17, 2014 at 3:59 PM, Ingo Schmid <[email protected]> wrote: >>> Craig, >>> >>> thanks, but that did not help. The code that really bugs me is this one: >>> >>> >>> $res=$self*$other # >>> $res->sethdr($self->hdr_copy); >>> say "keys self: ",%{$self->hdr}; >>> say "keys other: ",%{$other->hdr}; >>> say "keys res: ",%{$res->hdr}; >>> >>> When I use PDL Transform to generate $other, I get this: >>> >>> keys self: >>> typusphaseorientationTraselfImage1max3.13852469201402xHASH(0x52257c8) >>> channelHASH(0x4c1db68)SetHASH(0x51e19c8)ascconvHASH(0x5213078) >>> yHASH(0x52130c0)slzroxndims7echoHASH(0x5176930)tHASH(0x5203338)linksHASH(0x4bc0e20)parentroi1min-3.14159265358979active1dimnamesARRAY(0x4bcff00)updating1dicomHASH(0x4c9bb88)peyzHASH(0x4bca8b8)3d1 >>> >>> keys other: >>> yHASH(0x4b6dd80)dimnamesARRAY(0x4bcfa98)ndims3xHASH(0x4ae3df8)zHASH(0x4ca63f0) >>> >>> keys res: >>> yHASH(0x491b420)dimnamesARRAY(0x51ed588)ndims3xHASH(0x51b25d8)zHASH(0x4994820) >>> >>> You see, the header is copied from $other, not from $self, but only if >>> $other was the result of map(t_linear ...), see below. >>> It works as expected otherwise. >>> >>> That's why I wanted a "clean" piddle. >>> >>> Ingo >>> >>> On 03/17/2014 08:38 PM, Craig DeForest wrote: >>> >>> Ah. It's putting a scientific coordinate system in there in FITS form. You >>> want to use the "pix=>1" option to map to work in pixel coordinates. >>> Otherwise the output image is autoscaled to fit most of the output into the >>> output grid, and the mapping between output scientific coordinates and >>> output pixel coordinates is stored in WCS FITS-header form. >>> >>> Try: >>> >>> $u = $ts->map($x,{pix=>1}); >>> >>> >>> On Mar 17, 2014, at 1:35 PM, Ingo Schmid <[email protected]> wrote: >>> >>> $a=zeroes(10,10) >>> $ts=t_linear(s=>3) >>> $u=$ts->map($x) >>> p %{$u->gethdr} >>> CRVAL2 13.5 CDELT1 3 CRPIX1 5.5 SIMPLE T CRVAL1 13.5 HISTORY Header written >>> by PDL::Transform::Cartography::map NAXIS 2 CRPIX2 5.5 CUNIT1 NAXIS1 10 >>> CDELT2 3 CTYPE1 CUNIT2 CTYPE2 NAXIS2 10 >>> >>> yes, they are piddles, but you see? >>> >>> My real transform is like that (simplified, so it may have some typos): >>> $maskb=$maska->copy->map(t_linear(s=>1,d=>3),[$sizex,$sizey,$sizez],{m=>'g', >>> ir=>$a,},); >>> $maskb->sethdr({}); >>> >>> Ingo >>> >>> >>> On 03/17/2014 08:22 PM, Craig DeForest wrote: >>> >>> What method are you using to map? The map() and apply() methods both return >>> PDLs... >>> >>> On Mar 17, 2014, at 1:21 PM, Ingo Schmid <[email protected]> wrote: >>> >>> Hi, >>> >>> I use PDL::Transform to map piddles from one coordinate system to another. >>> My problem is, that after the transform, the result is a PDL::Transform >>> object, which seems to interfere with my own module. >>> >>> How do I get a naked piddle back after a map? I tried >>> $res->sethdr({}) >>> which clears the header alright, but that doesn't cut it for me somehow. I >>> need full access to the piddle header, my guess is, that after the hard >>> reset of the header, something bad happens. >>> >>> Ingo >>> >>> >>> >>> >>> >>> >>> _______________________________________________ >>> Perldl mailing list >>> [email protected] >>> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl >>> > > _______________________________________________ > Perldl mailing list > [email protected] > http://mailman.jach.hawaii.edu/mailman/listinfo/perldl > _______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
