-
Notifications
You must be signed in to change notification settings - Fork 503
Installation and Usage
Joost van Griethuysen edited this page Oct 20, 2016
·
3 revisions
This is a work in progress addressing https://github.com/Radiomics/pyradiomics/issues/102
-
To get the code:
Clone the repository:
git clone git://github.com/Radiomics/pyradiomics
-
Install on your system:
For mac/linux:
cd pyradiomics; sudo python setup.py install
-
If you don't have sudo/admin rights on your maching, you need to locally install numpy, SimpleITK, tqdm, PyWavelets
-
Run the example, helloRadiomics:
python bin/helloRadiomics.py
-
Interactively:
Add pyradiomics to the environment variable PYTHONPATH:
setenv PYTHONPATH /path/to/pyradiomics/radiomics
Start the python interactive session:
python
Import the necessary classes:
from radiomics import firstorder, glcm, imageoperations, shape, rlgl, glszm import SimpleITK as sitk import sys, os
Set up a data directory variable: `dataDir = '/path/to/data'
Use SimpleITK to read an image and mask:
imageName = str(dataDir + os.path.sep + 'image.nrrd') maskName = str(dataDir + os.path.sep + 'label.nrrd') image = sitk.ReadImage(imageName) mask = sitk.ReadImage(maskName)
Calculate some first order features:
firstOrderFeatures = firstorder.RadiomicsFirstOrder(image,mask) firstOrderFeatures.calculateFeatures() for (key,val) in firstOrderFeatures.featureValues.iteritems(): print ' ',key,':',val