# it has to be a single component, itk::VTKImageImport doesn't support more lum = vtk.vtkImageLuminance() lum.SetInput(reader.GetOutput()) # let's cast the output to float imageCast = vtk.vtkImageCast() imageCast.SetOutputScalarTypeToFloat() 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():