File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -84,13 +84,13 @@ A common use case for using ITK in Python is to mingle NumPy and ITK operations
8484The following script shows how to integrate NumPy and ITK:
8585
8686.. literalinclude :: code/MixingITKAndNumPy.py
87- :lines: 8-32
87+ :lines: 8-33
8888
8989
9090Similar functions are available to work with VNL vector and matrices:
9191
9292.. literalinclude :: code/MixingITKAndNumPy.py
93- :lines: 34 -
93+ :lines: 35 -
9494
9595
9696Examples
Original file line number Diff line number Diff line change 1111# Read input image
1212itk_image = itk .imread (input_filename )
1313
14- #run filters on itkImage
14+ # Run filters on itk.Image
1515
16- #view only of itkImage , data is not copied
17- np_view = itk .GetArrayViewFromImage ( itk_image )
16+ # View only of itk.Image , data is not copied
17+ np_view = itk .GetArrayViewFromImage (itk_image )
1818
19- #copy of itkImage , data is copied
20- np_copy = itk .GetArrayFromImage ( itk_image )
19+ # Copy of itk.Image , data is copied
20+ np_copy = itk .GetArrayFromImage (itk_image )
2121
2222
23- #do numpy stuff
23+ # Do numpy stuff
2424
25- #convert back to itk, view only, data is not copied
26- itk_np_view = itk .GetImageViewFromArray ( np_copy )
2725
28- #convert back to itk, data is not copied
29- itk_np_copy = itk .GetImageFromArray ( np_copy )
26+ # Convert back to itk, view only, data is not copied
27+ itk_np_view = itk .GetImageViewFromArray (np_copy )
28+
29+ # Convert back to itk, data is not copied
30+ itk_np_copy = itk .GetImageFromArray (np_copy )
3031
3132# Save result
3233itk .imwrite (itk_np_view , output_filename )
You can’t perform that action at this time.
0 commit comments