using System;
namespace itk.simple.examples
{
{
{
m_Method = m;
}
public override void Execute()
{
Console.Write("{0,3} = {1,10:F5} : [",
for (int i = 0; i < pos.Count; i++)
{
if (i > 0) Console.Write(", ");
Console.Write("{0:F5}", pos[i]);
}
Console.WriteLine("]");
}
}
class ImageRegistrationMethod4
{
static void Main(string[] args)
{
if (args.Length < 3)
{
Console.WriteLine("Usage: ImageRegistrationMethod4 <fixedImageFile> <movingImageFile> <outputTransformFile> [numberOfBins] [samplingPercentage]");
return;
}
uint numberOfBins = 24;
double samplingPercentage = 0.10;
if (args.Length > 3)
{
numberOfBins = uint.Parse(args[3]);
}
if (args.Length > 4)
{
samplingPercentage = double.Parse(args[4]);
}
IterationUpdate cmd = new IterationUpdate(R);
Console.WriteLine("-------");
Image cimg = SimpleITK.Compose(simg1, simg2, SimpleITK.Divide(SimpleITK.Add(simg1, simg2), 2));
if (Environment.GetEnvironmentVariable("SITK_NOSHOW") == null)
{
SimpleITK.Show(cimg, "ImageRegistration4 Composition");
}
}
}
}
An implementation of the Command design pattern for callback.
An interface method to the modular ITKv4 registration framework.
void SetMetricSamplingStrategy(MetricSamplingStrategyType strategy)
Set sampling strategy for sample generation.
void SetInterpolator(InterpolatorEnum Interpolator)
Set and get the interpolator to use.
Transform Execute(const Image &fixed, const Image &moving)
Optimize the configured registration problem.
std::vector< double > GetOptimizerPosition() const
void SetMetricAsMattesMutualInformation(unsigned int numberOfHistogramBins=50)
Use the mutual information between two images to be registered using the method of Mattes et al.
void SetMetricSamplingPercentage(double percentage, unsigned int seed=sitkWallClock)
Set percentage of pixels sampled for metric evaluation.
std::string GetOptimizerStopConditionDescription() const
MetricSamplingStrategyType
Sampling strategies for obtaining points.
void SetOptimizerAsRegularStepGradientDescent(double learningRate, double minStep, unsigned int numberOfIterations, double relaxationFactor=0.5, double gradientMagnitudeTolerance=1e-4, EstimateLearningRateType estimateLearningRate=Never, double maximumStepSizeInPhysicalUnits=0.0)
Regular Step Gradient descent optimizer.
unsigned int GetOptimizerIteration() const
double GetMetricValue() const
void SetInitialTransform(const Transform &transform)
Set the initial transform and parameters to optimize.
The Image class for SimpleITK.
unsigned int GetDimension() const
virtual int AddCommand(itk::simple::EventEnum event, itk::simple::Command &cmd)
Add a Command Object to observer the event.
Resample an image via a coordinate transform.
Image Execute(const Image &image1)
void SetInterpolator(InterpolatorEnum Interpolator)
void SetTransform(Transform Transform)
void SetReferenceImage(const Image &refImage)
void SetDefaultPixelValue(double DefaultPixelValue)
EventEnum
Events which can be observed from ProcessObject.
PixelIDValueEnum
Enumerated values of pixelIDs.