SHARE
TWEET

Untitled

a guest Oct 20th, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import itk, sys
  2.  
  3. if len(sys.argv) != 7:
  4.     print("Usage: " + sys.argv[0] + " <inputImagePath> <maskImagePath>"
  5.                                     " <NumberOfBinsPerAxis> <PixelValueMin> "
  6.                                     "<PixelValueMax> <NeighborhoodRadius>")
  7.     sys.exit(1)
  8.  
  9. im = itk.imread(sys.argv[1])
  10. maskReader = itk.ImageFileReader.IUC3.New()
  11. maskReader.SetFileName(sys.argv[2])
  12. mask = maskReader.GetOutput()
  13.  
  14. filtr = itk.CoocurrenceTextureFeaturesImageFilter.New(im)
  15. filtr.SetMaskImage(mask)
  16. filtr.SetNumberOfBinsPerAxis(int(sys.argv[3]))
  17. filtr.SetHistogramMinimum(int(sys.argv[4]))
  18. filtr.SetHistogramMaximum(int(sys.argv[5]))
  19. filtr.SetNeighborhoodRadius([int(sys.argv[6]),int(sys.argv[6]),int(sys.argv[6])])
  20.  
  21. result = filtr.GetOutput()
  22.  
  23. itk.imwrite(result, "result.nrrd")
RAW Paste Data
Top