imageCast.SetInput(lum.GetOutput()) # the end-point of this VTK pipeline segment is a vtkImageExport vtkExporter = vtk.vtkImageExport() vtkExporter.SetInput(imageCast.GetOutput()) # it connects to the itk::VTKImageImport at the beginning of # the subsequent ITK pipeline; two-dimensional float type itkImporter = itk.itkVTKImageImportF2_New() # Call the magic function that connects the two. This will only be # available if you built ITK with ITK_CSWIG_CONNECTVTKITK set to ON. CVIPy.ConnectVTKToITKF2(vtkExporter, itkImporter.GetPointer()) # perform a canny edge detection and rescale the output canny = itk.itkCannyEdgeDetectionImageFilterF2F2_New() rescaler = itk.itkRescaleIntensityImageFilterF2US2_New() canny.SetInput(itkImporter.GetOutput()) rescaler.SetInput(canny.GetOutput()) rescaler.SetOutputMinimum(0) rescaler.SetOutputMaximum(65535) # this is to show off the new PyCommand functionality. :) def progressEvent(): print "%.0f%s done..." % (canny.GetProgress() * 100.0, '%') pc = itk.itkPyCommand_New() pc.SetCommandCallable(progressEvent) canny.AddObserver(itk.itkProgressEvent(), pc.GetPointer()) # end of show-off