This file is indexed.

/usr/bin/xfmflip is in minc-tools 2.1.00-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#! /usr/bin/env perl
#
# Andrew Janke - a.janke@gmail.com
#
# Copyright Andrew Janke, The University of Queensland.
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies.
# The author and the University make no representations about the
# suitability of this software for any purpose.  It is provided "as is"
# without express or implied warranty.
#
# Flips an xfm in the given direction


use strict;
use warnings "all";
use Getopt::Tabular;
use File::Basename;
use File::Temp qw/ tempdir /;


my($Help, $Usage, $me, @opt_table, $tmpdir, $history, %opt);
my(@args, $inxfm, $outxfm);

# Argument variables and table
$me = &basename($0);
$tmpdir = "/tmp/$me-$$";
%opt = (
   'verbose' => 0,
   'clobber' => 0,
   'fake' => 0,
   'todo' => 0,
   );

$Help = <<HELP;
| $me is designed to flip a .xfm file in a given direction
|    This can done in either the coronal, sagittal or 
|    transverse plane.
|
| Thanks to Vladimir Fonov for pointing out that I was 
|    was making things somewhat hard for myself and
|    suggesting a slightly more abridged version..
|
| Problems or comments should be sent to: a.janke\@gmail.com
HELP

$Usage = "Usage: $me [options] <in.xfm> <out.xfm>\n".
         "       $me -help to list options\n\n";

@opt_table = (
   ["General Options", "section" ],
   ["-version", "call", 0, \&print_version_info,
      "print version and exit" ],
   ["-verbose", "boolean", 0, \$opt{verbose},
      "be verbose"],
   ["-clobber", "boolean", 0, \$opt{clobber},
      "clobber existing files"],
   ["-fake", "boolean", 0, \$opt{fake},
      "do a dry run, (echo cmds only)" ],
      
   ["Flipping Options", "section" ],
   ["-x", "const", '0', \$opt{todo}, 
      "flip xfm in x (default)" ],
   ["-y", "const", '1', \$opt{todo}, 
      "flip xfm in y" ],
   ["-z", "const", '2', \$opt{todo}, 
      "flip xfm in z" ],
   );

# get history string
chomp($history = `date`);
$history .= '>>>> ' . join(' ', $me, @ARGV);

# check arguments
&Getopt::Tabular::SetHelp($Help, $Usage);
&GetOptions (\@opt_table, \@ARGV) || exit 1;
die $Usage if ($#ARGV < 1);
$inxfm = $ARGV[0];
$outxfm = $ARGV[1];

# check for the input and output xfm
die "$me: Couldn't find $inxfm\n" if (!-e $inxfm);
die "$me: $outxfm exists! use -clobber to overwrite\n" if (-e $outxfm && !$opt{'clobber'});

# make tmpdir
$tmpdir = &tempdir( "$me-XXXXXXXX", TMPDIR => 1, CLEANUP => 1 );

my @flips = (
   [-1,  1,  1], 
   [ 1, -1,  1], 
   [ 1,  1, -1]
   );

# generate a temporary flip xfm
&do_cmd('param2xfm', '-clobber', 
        '-center', 0, 0, 0,
        '-scales', @{$flips[$opt{todo}]},
        "$tmpdir/flip.xfm");

# create the flip xfm
&do_cmd('xfmconcat', 
        "$tmpdir/flip.xfm", $inxfm, "$tmpdir/flip.xfm",
        $outxfm);


# do the dogy and add a history string (this may well bite me later on)
my @buf = split("\n", `cat $outxfm`);
open(FH, ">$outxfm");

print FH shift(@buf) . "\n" .
         "%\n" .
         "% Created by $me\n" .
         "%\n" .
         "% $history \n" .
         "\n" .
         join("\n", @buf) . "\n";
close(FH);

sub do_cmd { 
   print STDOUT "@_\n" if $opt{verbose};
   if(!$opt{fake}){
      system(@_) == 0 or die;
      }
   }
   
sub print_version_info {
   my($package, $version, $package_bugreport);

   $package = 'minc';
   $version = '2.1.00';
   $package_bugreport = 'Andrew Janke <a.janke@gmail.com>';

   print STDOUT "\n$package version $version\n".
                "Comments to $package_bugreport\n\n";
   exit;
   }