<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Here is the C# command example:<div><br></div><div><a href="https://github.com/SimpleITK/SimpleITK/blob/master/Examples/FilterProgressReporting.cs">https://github.com/SimpleITK/SimpleITK/blob/master/Examples/FilterProgressReporting.cs</a></div><div><br></div><div>That with the python registration examples should be enough to write a command to report information at each iteration as needed.</div><div><br></div><div>HTH,</div><div>Brad</div><div><br><div><div>On Jun 19, 2015, at 6:37 PM, Matias Montroull <<a href="mailto:matimontg@gmail.com">matimontg@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr">Hi, I have this code so far for doing registration with SimpleITK. I've run it and seems to work ok but the offset and matrix doesn't change so I think I'm missing the command part which I haven't been able to figure out.. I marked in bold what I think needs further code, unfortunately I haven't found any example in C#, all is in Pyton or C++, I was able to kind of translate to C# and figure out but the Command part is a struggle for me so far..<div><br></div><div><div> itk.simple.Image Imagen_fija = new itk.simple.Image();</div><div> itk.simple.Image Imagen_flotante = new itk.simple.Image();</div><div><br></div><div> ImageSeriesReader reader_fija = new ImageSeriesReader();</div><div> var archivosdcm_fija = ImageSeriesReader.GetGDCMSeriesFileNames(@"C:\TRACKER\Pacientes\ST1_CT\DCM");</div><div> reader_fija.SetFileNames(archivosdcm_fija);</div><div> Imagen_fija = reader_fija.Execute();</div><div><br></div><div> ImageSeriesReader reader_flotante = new ImageSeriesReader();</div><div> var archivosdcm_flotante = ImageSeriesReader.GetGDCMSeriesFileNames(@"C:\TRACKER\Pacientes\ST1_RM\DCM");</div><div> reader_flotante.SetFileNames(archivosdcm_flotante);</div><div> Imagen_flotante = reader_flotante.Execute();</div><div><br></div><div> CastImageFilter conversorafloat = new CastImageFilter(); conversorafloat.SetOutputPixelType(itk.simple.PixelIDValueEnum.sitkFloat32);</div><div> Imagen_fija = conversorafloat.Execute(Imagen_fija);</div><div> Imagen_flotante = conversorafloat.Execute(Imagen_flotante);</div><div> </div><div> ImageRegistrationMethod R = new ImageRegistrationMethod();</div><div> R.SetMetricAsMattesMutualInformation(50); //numberof histogrambins</div><div> R.SetMetricSamplingPercentage(3.0); //Sampling %</div><div> R.SetOptimizerAsRegularStepGradientDescent(16.0, 0.1, 100, 0.99); //max step, min step, iteraciones, relaxation</div><div> R.SetInterpolator(InterpolatorEnum.sitkLinear);</div><div> </div><div> AffineTransform transform = new AffineTransform(3);</div><div> itk.simple.Transform Initial_transform = SimpleITK.CenteredTransformInitializer(Imagen_fija, Imagen_flotante, transform, CenteredTransformInitializerFilter.OperationModeType.GEOMETRY);</div><div> R.SetInitialTransform(Initial_transform);</div><div> ResampleImageFilter resampler_fija = new ResampleImageFilter();</div><div> resampler_fija.SetReferenceImage(Imagen_fija);</div><div> resampler_fija.SetTransform(Initial_transform);</div><div> resampler_fija.SetInterpolator(InterpolatorEnum.sitkLinear);</div><div> Imagen_fija= resampler_fija.Execute(Imagen_fija);</div><div><br></div><div> ResampleImageFilter resampler_flotante = new ResampleImageFilter();<br></div><div> resampler_flotante.SetReferenceImage(Imagen_flotante);</div><div> resampler_flotante.SetTransform(Initial_transform);</div><div> resampler_flotante.SetInterpolator(InterpolatorEnum.sitkLinear);</div><div> Imagen_flotante = resampler_flotante.Execute(Imagen_flotante);</div><div><b> itk.simple.Command cmd = new Command();</b></div><div><b> R.AddCommand(EventEnum.sitkIterationEvent, cmd);</b></div><div> </div><div> itk.simple.Transform transform_final = R.Execute(Imagen_fija, Imagen_flotante);</div><div> double metrica = R.GetMetricValue();</div></div></div><div dir="ltr">-- <br></div><div dir="ltr">Matias</div>
_____________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br>http://www.kitware.com/products/protraining.php<br><br>Please keep messages on-topic and check the ITK FAQ at:<br>http://www.itk.org/Wiki/ITK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://public.kitware.com/mailman/listinfo/insight-users<br>_______________________________________________<br>Community mailing list<br>Community@itk.org<br>http://public.kitware.com/mailman/listinfo/community<br></blockquote></div><br></div></body></html>