[Insight-users] GPU Demons registration in ITK 4.2

Gareth Price Gareth.Price at physics.cr.man.ac.uk
Thu Jul 19 11:53:56 EDT 2012


Hi there,

 

Thanks for the swift response Bao. I've sent you the data files. For
completeness, I've posted these pared down code snippets of my CPU and
GPU code (I've excluded all code that I don't think is relevant). Note
that _source and _target are itk::Image<int,3> objects and as one is a
geometric transform of the other they should not require histogram
matching.

 

The CPU version that works fine:

 

      typedef itk::Image<float,3> InternalImageType;

      typedef itk::Vector<float,3> VectorPixelType;

      typedef itk::Image<VectorPixelType,3> DeformationFieldType;

      typedef
itk::DemonsRegistrationFilter<InternalImageType,InternalImageType,

            DeformationFieldType> RegistrationFilterType;

 

      RegistrationFilterType::Pointer
demons=RegistrationFilterType::New();

 

      typedef itk::CastImageFilter<ImageType,InternalImageType>
CastFilterType;

      CastFilterType::Pointer sourceCast=CastFilterType::New();

      CastFilterType::Pointer targetCast=CastFilterType::New();

 

      targetCast->SetInput(_target);

      sourceCast->SetInput(_source);

 

      demons->SetMovingImage(sourceCast->GetOutput());

      demons->SetFixedImage(targetCast->GetOutput());

      demons->SetNumberOfIterations(50);

      demons->SetSmoothDisplacementField(true);

      demons->SetStandardDeviations(10.0);

      demons->SetMaximumRMSError(0.01);

 

      demons->Update(); 

 

The GPU version I am having problems with:

 

      typedef itk::GPUImage<float,3> GPUImageType;

      typedef itk::Vector<float,3> VectorPixelType;

      typedef itk::GPUImage<VectorPixelType,3> DeformationFieldType;

      typedef
itk::GPUDemonsRegistrationFilter<GPUImageType,GPUImageType,

            DeformationFieldType> RegistrationFilterType;

 

      GPUImageType::Pointer gpuSource=GPUImageType::New();

      GPUImageType::Pointer gpuTarget=GPUImageType::New();

 

      RegistrationFilterType::Pointer
demons=RegistrationFilterType::New();

 

      typedef itk::CastImageFilter<ImageType,GPUImageType>
CastFilterType;

      CastFilterType::Pointer sourceCast=CastFilterType::New();

      CastFilterType::Pointer targetCast=CastFilterType::New();

 

      targetCast->SetInput(_target);

      sourceCast->SetInput(_source);

 

      demons->SetMovingImage(sourceCast->GetOutput());

      demons->SetFixedImage(targetCast->GetOutput());

 

      demons->SetNumberOfIterations(50);

      demons->SetSmoothDisplacementField(true);

      demons->SetStandardDeviations(10.0);

      demons->UseMovingImageGradientOn();

      demons->SetMaximumRMSError(0.01);

 

      demons->Update(); 

 

Thanks again, Gareth

 

 

-----Original Message-----
From: insight-users-bounces at itk.org
[mailto:insight-users-bounces at itk.org] On Behalf Of Baohua Wu
Sent: 19 July 2012 14:59
To: Gareth Price
Cc: insight-users at itk.org; James Gee
Subject: Re: [Insight-users] GPU Demons registration in ITK 4.2

 

Gareth,

 

Sorry for the problem you experienced. I am a main developer for GPU
demons in ITK4.2. Would you please send me the images and the testing
parameters you used? 

 

Thank you for reporting this issue!

 

Bao

	----- Original Message ----- 

	From: James Gee <mailto:gee at mail.med.upenn.edu>  

	To: Baohua Wu <mailto:baohua at mail.med.upenn.edu>  ; Avants Brian
<mailto:stnava at gmail.com>  

	Sent: Thursday, July 19, 2012 9:30 AM

	Subject: Fwd: [Insight-users] GPU Demons registration in ITK 4.2

	 

	
	
	Sent from my iPhone

	
	Begin forwarded message:

		From: Gareth Price <Gareth.Price at physics.cr.man.ac.uk>
		Date: July 19, 2012 8:24:40 AM EDT
		To: <insight-users at itk.org>
		Subject: [Insight-users] GPU Demons registration in ITK
4.2

		Hi there,

		 

		I was wondering if someone might be able to offer advice
regarding the new ITK 4.2 GPU implementation of the demons algorithm.

		 

		I have an application using the standard CPU
implementation to register 3D CT images (512x512x~70 voxels). This
behaves perfectly when registering synthetic deformations to their
original image. I typically use a smoothing kernel standard deviation of
10.0 with no update field smoothing. With my images, the metric reduces
exponentially as expected from ~8000 to 350 over 50 iterations with the
RMS update field change showing a similar but slower trend from ~0.08 to
0.04. After 50 iterations the solutions have made good progress towards
the original images. 

		 

		Porting this code to the GPU implementation following
the examples in the itkGPUDemonsRegistrationFilterTests (i.e. swapping
the internal image type for GPUImageType and GPUDemonsRegistrationFilter
for DemonsRegistrationFilter) provides an immediate ~x15 increase in
speed on my machine (GeForce GTX480). However using the same input data
and smoothing parameters, the metric and RMS update field trends,
although still exponential show changes from ~8000 to 1500 (metric) and
~0.3 to 0.2 (update field). The result is that the deformation field
produced is much too large. Changing smoothing parameters does not
change this behaviour, whilst enabling update field smoothing crashes
the process (in GPUDemonsRegistrationFilter::ApplyUpdate). It is very
strange that the similarity metric is continuing to reduce as the
deformation field pushes the moving image through and past its correct
fixed image alignment.

		 

		Would someone be able to tell me if this is expected
behaviour/are known bugs, or offer advice if I am using the GPU
registration filter incorrectly?

		 

		Many thanks, Gareth

		 

		
________________________________


	
****************************************************************
		This e-mail and any files transmitted with it are
confidential
		and solely for the use of the intended recipient. If you
have
		received this e-mail in error you should not
disseminate,
		distribute or copy it. Please notify the sender
immediately and
		delete this e-mail from your system.
	
****************************************************************

		_____________________________________
		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://www.itk.org/mailman/listinfo/insight-users



****************************************************************
This e-mail and any files transmitted with it are confidential
and solely for the use of the intended recipient. If you have
received this e-mail in error you should not disseminate,
distribute or copy it. Please notify the sender immediately and
delete this e-mail from your system.
****************************************************************

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120719/8877e9c1/attachment.htm>


More information about the Insight-users mailing list