Skip to content

Commit

Permalink
ENH: Restructure Folders
Browse files Browse the repository at this point in the history
Restructure folders to better catalog the scripts and jupyter notebooks not part of the pyradiomics core code.
Example scripts, notebooks and example parameter files are now stored in the directory tree under `examples`.
The `bin` folder now only contains some scripts useful for developers and for specific use cases. These include a script to generate and add a baseline for a new featureclass and a script to resample a mask to the image geometry.

Update the references to these files where necessary in the documentation.
  • Loading branch information
JoostJM committed May 9, 2017
1 parent 9e1e847 commit b668158
Show file tree
Hide file tree
Showing 20 changed files with 29 additions and 30 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ jobs:
name: Install test data
command: |
cp -r data /tmp/example_data
cp bin/Params.yaml /tmp
cp -r bin/Notebooks/*.ipynb /tmp
cp examples/exampleSettings/Params.yaml /tmp
cp -r examples/Notebooks/*.ipynb /tmp
# helloFeatureClass is not ready for inclusion yet, so isn't being tested
rm -f /tmp/hello*.ipynb
- run:
Expand Down
7 changes: 4 additions & 3 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ For various reasons, both image and mask must have the same geometry (i.e. same
when passed the feature classes. To this end PyRadiomics includes checks in the pipeline to ensure this is the case.
If resampling is enabled, the mask is allowed to be of a different geometry, so long as the bounding box of the Region
of Interest (ROI) represents a physical space that is within the image. If resampling is disabled, mask and image are
required to be of the same geometry. For more information on resampling, see :py:func:`~imageoperations.resampleImage`.
For more information on the mask checks, see :py:func:`~imageoperations.checkMask`. Alternatively, you could also
resample the mask to image space. An example of this is provided in ``bin\resampleMask.py``.
required to be of the same geometry. For more information on resampling, see
:py:func:`~radiomics.imageoperations.resampleImage`. For more information on the mask checks, see
:py:func:`~radiomics.imageoperations.checkMask`. Alternatively, you could also resample the mask to image space. An
example of this is provided in ``bin/resampleMask.py``.

**What modalities does PyRadiomics support?**

Expand Down
20 changes: 9 additions & 11 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ Example

* The sample sample data is provided in ``pyradiomics/data``

* Use `jupyter <http://jupyter.org/>`_ to run the helloRadiomics example, located in ``pyradiomics/bin/Notebooks``
* Use `jupyter <http://jupyter.org/>`_ to run the helloRadiomics example, located in ``pyradiomics/examples/Notebooks``

* Jupyter can also be used to run the example notebook as shown in the instruction video

* The example notebook can be found in ``pyradiomics/bin/Notebooks``
* The example notebook can be found in ``pyradiomics/examples/Notebooks``

* The parameter file used in the instruction video is available in ``pyradiomics/bin``
* The parameter file used in the instruction video is available in ``pyradiomics/examples/exampleSettings``

* If jupyter is not installed, run the python script alternative (``pyradiomics/bin/helloRadiomics.py``):
* If jupyter is not installed, run the python script alternative (``pyradiomics/examples/helloRadiomics.py``):

* ``python helloRadiomics.py``

Expand Down Expand Up @@ -105,7 +105,7 @@ Interactive Use

* Import the necessary classes::

from radiomics import featureextractor
from radiomics import featureextractor, getTestCase
import six
import sys, os

Expand All @@ -117,12 +117,11 @@ Interactive Use

* Store the path of your image and mask in two variables::

imageName = os.path.join(dataDir, "data", 'brain1_image.nrrd')
maskName = os.path.join(dataDir, "data", 'brain1_label.nrrd')
imageName, maskName = getTestCase('brain1', dataDir)

* Also store the path to the file containing the extraction settings::

params = os.path.join(dataDir, "bin", "Params.yaml")
params = os.path.join(dataDir, "examples", "exampleSettings", "Params.yaml")

* Instantiate the feature extractor class with the parameter file::

Expand Down Expand Up @@ -160,7 +159,7 @@ Using feature classes directly

* Import the necessary classes::

from radiomics import firstorder, glcm, imageoperations, shape, glrlm, glszm
from radiomics import firstorder, glcm, imageoperations, shape, glrlm, glszm, getTestCase
import SimpleITK as sitk
import six
import sys, os
Expand All @@ -173,8 +172,7 @@ Using feature classes directly

* Use SimpleITK to read a the brain image and mask::

imageName = str(dataDir + os.path.sep + 'brain1_image.nrrd')
maskName = str(dataDir + os.path.sep + 'brain1_label.nrrd')
imageName, maskName = getTestCase('brain1', dataDir)
image = sitk.ReadImage(imageName)
mask = sitk.ReadImage(maskName)

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@
"name": "stdout",
"output_type": "stream",
"text": [
"repositoryRoot, relative path: E:\\Git-Repos\\pyradiomics\\bin\\Notebooks\\..\\..\n",
"repositoryRoot, relative path: E:\\Git-Repos\\pyradiomics\\examples\\Notebooks\\..\\..\n",
"repositoryRoot, absolute path: E:\\Git-Repos\\pyradiomics\n",
"Parameter file, absolute path: E:\\Git-Repos\\pyradiomics\\bin\\Params.yaml\n"
"Parameter file, absolute path: E:\\Git-Repos\\pyradiomics\\examples\\exampleSettings\\Params.yaml\n"
]
}
],
Expand All @@ -73,11 +73,11 @@
"# Get the testCase\n",
"imagePath, maskPath = radiomics.getTestCase('brain1', repositoryRoot)\n",
"\n",
"if imageName is None or maskName is None: # Something went wrong, in this case PyRadiomics will also log an error\n",
"if imagePath is None or maskPath is None: # Something went wrong, in this case PyRadiomics will also log an error\n",
" print('Error getting testcase!')\n",
"\n",
"# Additonally, store the location of the example parameter file, stored in \\pyradiomics\\bin\n",
"paramPath = os.path.join(os.getcwd(), \"..\", \"Params.yaml\")\n",
"# Additonally, store the location of the example parameter file, stored in \\pyradiomics\\examples/exampleSettings\n",
"paramPath = os.path.join(os.getcwd(), \"..\", \"exampleSettings\", \"Params.yaml\")\n",
"print(\"Parameter file, absolute path:\", os.path.abspath(paramPath))"
]
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 9 additions & 9 deletions radiomics/shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ def getSphericityFeatureValue(self):
.. note::
This feature is correlated to Compactness 1, Compactness 2 and Spherical Disproportion. In the default
parameter file provided in the ``pyradiomics\bin`` folder, Compactness 1 and Compactness 2 are therefore
disabled.
parameter file provided in the ``pyradiomics/examples/exampleSettings`` folder, Compactness 1 and Compactness 2
are therefore disabled.
"""
return (36 * numpy.pi * self.Volume ** 2) ** (1.0 / 3.0) / self.SurfaceArea

Expand All @@ -257,8 +257,8 @@ def getCompactness1FeatureValue(self):
.. note::
This feature is correlated to Compactness 2, Sphericity and Spherical Disproportion. In the default
parameter file provided in the ``pyradiomics\bin`` folder, Compactness 1 and Compactness 2 are therefore
disabled.
parameter file provided in the ``pyradiomics/examples/exampleSettings`` folder, Compactness 1 and Compactness 2
are therefore disabled.
"""
return ((self.Volume) / ((self.SurfaceArea) ** (3.0 / 2.0) * numpy.sqrt(numpy.pi)))

Expand All @@ -279,8 +279,8 @@ def getCompactness2FeatureValue(self):
.. note::
This feature is correlated to Compactness 1, Sphericity and Spherical Disproportion. In the default
parameter file provided in the ``pyradiomics\bin`` folder, Compactness 1 and Compactness 2 are therefore
disabled.
parameter file provided in the ``pyradiomics/examples/exampleSettings`` folder, Compactness 1 and Compactness 2
are therefore disabled.
"""
return ((36.0 * numpy.pi) * ((self.Volume) ** 2.0) / ((self.SurfaceArea) ** 3.0))

Expand All @@ -301,9 +301,9 @@ def getSphericalDisproportionFeatureValue(self):
.. note::
This feature is correlated to Compactness 1, Sphericity and Spherical Disproportion. In the default
parameter file provided in the ``pyradiomics\bin`` folder, Compactness 1 and Compactness 2 are therefore
disabled.
This feature is correlated to Compactness 1, Compactness 2 and Sphericity. In the default
parameter file provided in the ``pyradiomics/examples/exampleSettings`` folder, Compactness 1 and Compactness 2
are therefore disabled.
"""
return self.SurfaceArea / (36 * numpy.pi * self.Volume ** 2) ** (1.0 / 3.0)

Expand Down

0 comments on commit b668158

Please sign in to comment.