[MINC-users] bug in mritoself

Alex ZIJDENBOS alex at bic.mni.mcgill.ca
Mon Mar 12 13:39:39 EDT 2007


I just came across what I would consider a bug in mritoself, and which
may have affected users of it: if the source and target volumes have
the same filename (from two different dirs, obviously), the result
will always be the identity transform. This is because of this little
bit of code in the Crop sub:

   $cropped = "${TmpDir}/${base}_${label}.mnc";
   return ($cropped, \@crop, \@subsample) if (-e $cropped);

which is called the same way for the source and target volumes. As a
result the minctracc call which follows will register the same temp
file against itself.

There are a few different ways to solve this, but a simple one would
be to replace

($source_cropped, $source_crop, $source_subsample)=
   &Crop ($SourceBase, $Source, "crop", 
          $GuessCrop, $GuessSubsample, \@Subsample, \@Crop);
($target_cropped, $target_crop, $target_subsample) =
   &Crop ($TargetBase, $Target, "crop",
          $GuessCrop, $GuessSubsample, \@Subsample, \@Crop);

with

($source_cropped, $source_crop, $source_subsample)=
   &Crop ($SourceBase, $Source, "crop_source", 
          $GuessCrop, $GuessSubsample, \@Subsample, \@Crop);
($target_cropped, $target_crop, $target_subsample) =
   &Crop ($TargetBase, $Target, "crop_target",
          $GuessCrop, $GuessSubsample, \@Subsample, \@Crop);

-- A


More information about the MINC-users mailing list