using System;
namespace itk.simple.examples
{
{
{
m_Method = m;
}
public override void Execute()
{
{
Console.Write("Scales: [" + scales[0]);
for (int i = 1; i < scales.Count; i++)
{
Console.Write(", " + scales[i]);
}
Console.WriteLine("]");
}
Console.Write("{0,3} = {1,7:F5} : [{2:F5}",
pos[0]);
for (int i = 1; i < pos.Count; i++)
{
Console.Write(", {0:F5}", pos[i]);
}
Console.WriteLine("]");
}
}
class ImageRegistrationMethodExhaustive
{
static void Main(string[] args)
{
if (args.Length < 3)
{
Console.WriteLine("Usage: ImageRegistrationMethodExhaustive <fixedImageFile> <movingImageFile> <outputTransformFile>");
return;
}
int samplePerAxis = 12;
{
VectorUInt32 exhaustiveSteps = new VectorUInt32(new uint[] { (uint)(samplePerAxis / 2), 0, 0 });
VectorDouble scales = new VectorDouble(new double[] { 2.0 * Math.PI / samplePerAxis, 1.0, 1.0 });
}
{
VectorUInt32 exhaustiveSteps = new VectorUInt32(new uint[] {
(uint)(samplePerAxis / 2),
(uint)(samplePerAxis / 2),
(uint)(samplePerAxis / 4),
0, 0, 0
});
VectorDouble scales = new VectorDouble(new double[] {
2.0 * Math.PI / samplePerAxis,
2.0 * Math.PI / samplePerAxis,
2.0 * Math.PI / samplePerAxis,
1.0, 1.0, 1.0
});
}
tx = SimpleITK.CenteredTransformInitializer(fixedImage, movingImage, tx);
IterationUpdate cmd = new IterationUpdate(R);
Console.WriteLine("-------");
if (Environment.GetEnvironmentVariable("SITK_NOSHOW") == null)
{
Image cimg = SimpleITK.Compose(simg1, simg2, SimpleITK.Divide(SimpleITK.Add(simg1, simg2), 2));
SimpleITK.Show(cimg, "ImageRegistrationExhaustive Composition");
}
}
}
}
An implementation of the Command design pattern for callback.
An interface method to the modular ITKv4 registration framework.
void SetOptimizerAsExhaustive(const std::vector< unsigned int > &numberOfSteps, double stepLength=1.0)
Set the optimizer to sample the metric at regular steps.
void SetInterpolator(InterpolatorEnum Interpolator)
Set and get the interpolator to use.
std::vector< double > GetOptimizerScales() const
Get the OptimizerScales.
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.
std::string GetOptimizerStopConditionDescription() const
void SetOptimizerScales(const std::vector< double > &scales)
Manually set per parameter weighting for the transform parameters.
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.