[MINC-users] Bug in mni_autoreg-0.98v ?

Andrew Janke a.janke at gmail.com
Wed Apr 5 16:13:48 EDT 2006


On 3/15/06, Simon Fristed Eskildsen <se at hst.aau.dk> wrote:
> Since we're correcting the perl scripts, I'm slightly annoyed by the way
> mritotal handles logging. Somewhere after version 0.98r mritotal has
> considered stdout as an open filehandle for logging, which means that it
> is not possible to pipe stdout from mritotal:
>     mritotal mri.mnc mri.xfm > test.log
>     self_announce: if supplied, $log must be an open filehandle at
> /gruppe/ad_mri/Opteron/pack/bin/mritotal line 571
> Removing the following from mritotal solves the problem:
>     &self_announce("STDOUT") if $Verbose && ! -t "STDOUT";
> I realize that the filehandle check is in the self_announce function,
> but i am reluctant to change anything in the mni_perllib.

As am I.  (changing things in mni_perllib)  In short after a bit of
digging into this and a holiday inbetween, I have come to the
conclusion that much of mni_perllib is no longer needed.  A lot of the
functionality it provided is now included in perl by default.

So my fix to this would be as such in mritotal:

diff -u -b -B -r1.18 mritotal.in
--- mritotal.in 7 Dec 2005 03:19:13 -0000       1.18
+++ mritotal.in 5 Apr 2006 19:59:15 -0000
@@ -565,10 +565,8 @@

    $, = ' ';     # set output field separator

-   # First, announce ourselves to stdout (for ease in later dissection
-   # of log files) -- unless STDOUT is a tty.
-
-   &self_announce("STDOUT") if $Verbose && ! -t "STDOUT";
+   # First, announce ourselves
+   &self_announce if $Verbose;

    # Set defaults for the global variables.  These can be overridden by
    # the configuration file or the command line.

This will fix the problem and should retain most of the old behaviour
(rather than just removing the offending line).

Thoughts?

I will make the change for 0.99.2

> Maybe a commandline option to mritotal for handling logging would be in
> order?

I'm adverse to adding such functionality to a perl program.  This
should be handled by a simple '>' on the command line! :)

Sorry about the delay with the reply.


a



More information about the MINC-users mailing list