[Insight-users] Median: different result on different machines

Atwood, Robert C r.atwood at imperial.ac.uk
Mon Aug 15 13:32:05 EDT 2005


 

________________________________

From: Atwood, Robert C
Sent: Thu 11/08/2005 19:06
To: ITK Mailing List
Subject: Median: different result on different machines


Dear ITK list:
 
I noticed different results on a new machine compared to the same code on the old machine, so I carefully removed all parts of my code until I had the minimum that exhibits the different results. It is basically 
 
ImageFileReader ---> MedianImageFilter ---> ImageFileWriter 
 
Machine 1:  Intel p4 2800 , RedHat enterprise WS-3 + online up2date, ITK from a few weeks ago cvs
 
Machine 2 Intel p4 3400 with em64t (x86_64) SUSE 9.1 + online Y.O.U. updates , ITK from today (but first I tried with the same ITK source as Machine 1 with the same effect.
 
 
On machine 1 the median result looks correct (here it is hard-coded radius 3 jsut to try) 
 
On machine 2 there is speckle noise that seems to appear as a result of the median.
 
Running the test program that was compiled on machine 1, on machine 2, does not give the speckles. I got rid of my slice print output routine in case that was causing it, and used an independant volume viewer to look at the volume, it is definintely speckly! 
 
I hope this is a simple problem  that someone already knows the answer for , and can share it with me. Otherwise, I can provide any additional details that will be useful to diagnose the problem. It would be nice if it worked on the new machine because it is considerably faster.
 
Thanks
Robert
 
 
(here's the code) 
 
 
#include <stdio.h>
#include <string.h>
#include <malloc.h>
#include "itkImage.h"
#include "itkImageFileWriter.h"
#include "itkImageFileReader.h"
#include "itkMedianImageFilter.h"
  typedef float PixelType;
  typedef itk::Image< PixelType, 3 > ScalarImageType;
  // definitions for writing the image
  typedef itk::ImageFileWriter< ScalarImageType > WriterType;
  typedef itk::ImageFileReader<ScalarImageType> ReaderType;
  //median filter 
  typedef itk::MedianImageFilter<ScalarImageType,ScalarImageType> VolMedian;
/*********************************/
/* beginning of MAIN routine     */
/*********************************/
int main(int argc, char ** argv) {
  int med_rad=3;
  /* ITK objects needed for processing the volume  */
  VolMedian::Pointer volmedian = VolMedian::New();
  ReaderType::Pointer reader = ReaderType::New();
  WriterType::Pointer writer = WriterType::New();
  ScalarImageType::SizeType vol_rad;
  if (argc != 2){
      printf("Little program to test itk median filter\n");
      printf("Usage: %s input.mhd\n",argv[0]);
      printf("Only itk registered data file types to avoid extra\n");
      printf("import filter code.\n");
      printf("Median radius fixed at %i\n",med_rad);
      return(0);
  }
  vol_rad[0] = med_rad;
  vol_rad[1] = med_rad;
  vol_rad[2] = med_rad;
  volmedian->SetRadius(vol_rad);
  printf("...3d Median ... itk radius %i ..\n",med_rad);
  volmedian->SetInput(reader->GetOutput());
     /* add the volume writer */
  writer->SetInput(volmedian->GetOutput());
  writer->SetFileName( "mediantest.mhd" );
  reader->SetFileName(argv[1]);
  try {
     writer->Update();
  }catch( itk::ExceptionObject & exp ) {
     std::cerr << "Exception caught 04 writer update !" << std::endl;
     std::cerr << exp << std::endl;
  }
  printf("All done\n");
  return (0);
}

 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20050815/13dd3e6d/attachment.htm


More information about the Insight-users mailing list