[ITK] [ITK-users] SimpleITK for Java Image Fusion and Co-registration?

ivan ivan.granata.na at gmail.com
Wed Oct 5 07:51:30 EDT 2016


i must coreg these 
CT with T1

the path already exist, yes


i use eclipse ide with these arguments
C:\Users\Ivan\workspace\ImageRegistrationMethod1\CT.nii
C:\Users\Ivan\workspace\ImageRegistrationMethod1\Headt1mpragesagp2iso08s007a1001.nii
C:\Users\Ivan\workspace\ImageRegistrationMethod1\registrata.nii


i tried this
http://review.source.kitware.com/#/c/21596/1/Examples/Java/ImageRegistrationMethod1.java
, but several errors appear
if i change parameters...change error

for example
i take a  minStep > 0.01; and error is on numberOfIterazions
i take a numberOfIterations > 20 or <200 and the error return on minStep
  same things on relaxationFactor = 0.5; or =0.8

i tried also this script but it is the same


import org.itk.simple.*;


class IterationUpdate  extends Command {

	  private ImageRegistrationMethod m_Method;

	  public IterationUpdate(ImageRegistrationMethod m) {
	    super();
	    m_Method=m;
	  }

	  public void execute() {
	    org.itk.simple.VectorDouble pos = m_Method.getOptimizerPosition();
	    System.out.format("%3d = %10.5f : [%f, %f]\n",
	                      m_Method.getOptimizerIteration(),
	                      m_Method.getMetricValue(),
	                      pos.get(0), pos.get(1));
	  }
	}

class ImageRegistrationMethod1 {

  public static void main(String argv[]) {

  if ( argv.length < 3 )
    {
      System.out.format( "Usage: %s <fixedImageFilter> <movingImageFile>
<outputTransformFile>\n", "ImageRegistrationMethod1");
      System.exit(-1);
    }

  org.itk.simple.ImageFileReader reader = new
org.itk.simple.ImageFileReader();
  reader.setOutputPixelType( PixelIDValueEnum.sitkFloat32 );

  reader.setFileName(argv[0]);
  Image fixed = reader.execute();

  reader.setFileName(argv[1]);
  Image moving = reader.execute();

  org.itk.simple.ImageRegistrationMethod R = new 
org.itk.simple.ImageRegistrationMethod();
  
  
  

  
 
   int numberOfBins = 64;
  
  R.setMetricAsMattesMutualInformation(numberOfBins);
  
  double LearningRate = 8.0;
  long numberOfIterations = 100;
  double convergenceMinimumValue = 1e-6;
  long convergenceWindowSize = 10;
  double lineSearchLowerLimit = 0;
  
  R.setOptimizerAsGradientDescentLineSearch( LearningRate,
          numberOfIterations,
          convergenceMinimumValue,
          convergenceWindowSize,
          lineSearchLowerLimit
          );
  
  

  R.setInitialTransform( new org.itk.simple.TranslationTransform(
fixed.getDimension() ) );
  R.setInterpolator( InterpolatorEnum.sitkLinear );

  IterationUpdate cmd = new IterationUpdate(R);
  R.addCommand( EventEnum.sitkIterationEvent, cmd);

  org.itk.simple.Transform outTx = R.execute( fixed, moving );

  System.out.println("-------");
  System.out.println(outTx.toString());
  System.out.format("Optimizer stop condition: %s\n",
R.getOptimizerStopConditionDescription());
  System.out.format(" Iteration: %d\n", R.getOptimizerIteration());
  System.out.format(" Metric value: %f\n", R.getMetricValue());

  outTx.writeTransform(argv[2]);

  }

}






--
View this message in context: http://itk-users.7.n7.nabble.com/ITK-users-SimpleITK-for-Java-Image-Fusion-and-Co-registration-tp37600p37635.html
Sent from the ITK - Users mailing list archive at Nabble.com.
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list