[MINC-users] MNI::TagSet problem?

EJ Nikelski nikelski at bic.mni.mcgill.ca
Sat Apr 14 14:55:08 EDT 2007


Hi List,

   Peter, you are entirely correct. I thank-you muchly, as few problems have
taken me so close to openly weeping at my desk. BTW, for those (very few)
interested in this, there actually is an error in the code. Specifically,
TagPoint.pm (line 75) formats the output weight field as %d, when it really
should be a float -- resulting in non-floaty output. Another gottcha is that
Greg (Ward) stores a reference to the individual coordinates, so doing the
sort of thing listed below will result in all of the tag entries having the
same coordinates as the last entry.

<CODE>
# create the tagpoint object & APPEND to the tag file
my @coords = (11,22,33);
(my $tagPointObj1) = MNI::TagPoint->new(volume1 => \@coords, volume2 =>
\@coords,
                                       weight => 11.11, structure_id => 222,

                                       patient_id => 333, label => 'Label
number 1');
$tagFileObj->add_points( $tagPointObj1  );

# create another tagpoint object & append
@coords = (99,88,77);
(my $tagPointObj2) = MNI::TagPoint->new(volume1 => \@coords, volume2 =>
\@coords,
                                       weight => 99.99, structure_id => 888,

                                       patient_id => 777, label => 'This
would be the second label');
$tagFileObj->add_points( $tagPointObj2  );
</CODE>

Cheers,

-Jim



On 4/13/07, Peter Neelin <peter.neelin at gmail.com> wrote:
>
> On 4/13/07, EJ Nikelski <nikelski at bic.mni.mcgill.ca> wrote:
>
> > MNI::TagSet->save($tagObj, 'bbb.tag');
>
> It's been a while since I've looked at much perl object-oriented code,
> but if my memory serves me correctly, you want
>
> $tagObj->save('bbb.tag');
>
> (I'm basing this on zero experience with MNI::TagSet, BTW.)
>
> Perl will pass the object as the first argument. An invocation of the
> form MNI::TagSet->save() will pass the class as the first argument
> instead of the instance. The first argument thing is a bit funky, I
> realize, but perl's OO framework is a retrofit - an elegant hack in a
> perverse sort of way.
>
> Peter
> --
> Peter Neelin
> (peter.neelin at gmail.com)
> _______________________________________________
> MINC-users at bic.mni.mcgill.ca
> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users
>


More information about the MINC-users mailing list