Skip to content

Commit

Permalink
refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
ad12 committed Oct 6, 2018
1 parent 037a11e commit 070b652
Show file tree
Hide file tree
Showing 27 changed files with 746 additions and 562 deletions.
15 changes: 13 additions & 2 deletions defaults.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
DEFAULT_BATCH_SIZE = 32
# Default inference batch size - based on RAM of computer
# for 16 GB RAM , recommend 16
DEFAULT_BATCH_SIZE = 16

FIX_VISUALIZATION_BOUNDS = True
# Fix the bounds for the visualization colorbar based on the quantitative measure (T2, T1rho, etc)
# if any value exceeds these bounds, automatically set this parameter to False
FIX_VISUALIZATION_BOUNDS = True

# The dilation rate we use for dilating any mask before registration
DEFAULT_MASK_DIL_RATE = 8.0
DEFAULT_MASK_DIL_THRESHOLD = 0.2

# The R^2 fit threshold to include when estimating quantitative values
DEFAULT_R2_THRESHOLD = 0.9
69 changes: 69 additions & 0 deletions elastix_params/parameters-affine-interregister.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// *********************
// * affine
// *********************

// *********************
// * ImageTypes
// *********************
(FixedInternalImagePixelType "float")
(MovingInternalImagePixelType "float")
(UseDirectionCosines "true")

// *********************
// * Components
// *********************
(FixedImagePyramid "FixedSmoothingImagePyramid")
(MovingImagePyramid "MovingSmoothingImagePyramid")
(Registration "MultiResolutionRegistration")
(Interpolator "BSplineInterpolator")
(ResampleInterpolator "FinalBSplineInterpolator")
(Metric "AdvancedMattesMutualInformation")
(BSplineInterpolationOrder 1)
(Resampler "DefaultResampler")
(Optimizer "AdaptiveStochasticGradientDescent")
(Transform "AffineTransform")

// *********************
// * Mask settings
// *********************
(ErodeMask "false")
(ErodeFixedMask "false")

// *********************
// * Optimizer settings
// *********************
(NumberOfResolutions 1)
(MaximumNumberOfIterations 1000)
(ASGDParameterEstimationMethod "Original")
(AutomaticParameterEstimation "true")
(AutomaticTransformInitialization "true")
(AutomaticScalesEstimation "true")

// *********************
// * Transform settings
// *********************
(HowToCombineTransforms "Compose")

// *********************
// * Pyramid settings
// *********************
(NumberOfHistogramBins 32)


// *********************
// * Sampler parameters
// *********************
(NumberOfSpatialSamples 2000)
(ImageSampler "RandomSparseMask")
(CheckNumberOfSamples "true")
(NewSamplesEveryIteration "true")
(FinalBSplineInterpolationOrder 3)

// *********************
// * Output settings
// *********************
(DefaultPixelValue 0)
(WriteTransformParametersEachIteration "false")
(WriteResultImage "true")
(ResultImageFormat "nii.gz")
(ResultImagePixelType "float")
69 changes: 69 additions & 0 deletions elastix_params/parameters-rigid-interregister.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// *********************
// * rigid
// *********************

// *********************
// * ImageTypes
// *********************
(FixedInternalImagePixelType "float")
(MovingInternalImagePixelType "float")
(UseDirectionCosines "true")

// *********************
// * Components
// *********************
(FixedImagePyramid "FixedSmoothingImagePyramid")
(MovingImagePyramid "MovingSmoothingImagePyramid")
(Registration "MultiResolutionRegistration")
(Interpolator "BSplineInterpolator")
(ResampleInterpolator "FinalBSplineInterpolator")
(Metric "AdvancedMattesMutualInformation")
(BSplineInterpolationOrder 1)
(Resampler "DefaultResampler")
(Optimizer "AdaptiveStochasticGradientDescent")
(Transform "EulerTransform")

// *********************
// * Mask settings
// *********************
(ErodeMask "false")
(ErodeFixedMask "false")

// *********************
// * Optimizer settings
// *********************
(NumberOfResolutions 3)
(MaximumNumberOfIterations 1000)
(ASGDParameterEstimationMethod "Original")
(AutomaticParameterEstimation "true")
(AutomaticTransformInitialization "true")
(AutomaticScalesEstimation "true")

// *********************
// * Transform settings
// *********************
(HowToCombineTransforms "Compose")

// *********************
// * Pyramid settings
// *********************
(NumberOfHistogramBins 32)


// *********************
// * Sampler parameters
// *********************
(NumberOfSpatialSamples 2000)
(ImageSampler "RandomSparseMask")
(CheckNumberOfSamples "true")
(NewSamplesEveryIteration "true")
(FinalBSplineInterpolationOrder 3)

// *********************
// * Output settings
// *********************
(DefaultPixelValue 0)
(WriteTransformParametersEachIteration "false")
(WriteResultImage "true")
(ResultImageFormat "nii.gz")
(ResultImagePixelType "float")
214 changes: 107 additions & 107 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,111 +1,111 @@
name: tf
channels:
- conda-forge
- defaults
- conda-forge
- defaults
dependencies:
- boost=1.68.0=py36h3e44d54_0
- boost-cpp=1.68.0=h3a22d5f_0
- bzip2=1.0.6=1
- icu=58.2=hfc679d8_0
- blas=1.0=mkl
- ca-certificates=2018.03.07=0
- certifi=2018.8.24=py36_1
- cycler=0.10.0=py36hfc81398_0
- freetype=2.9.1=hb4e5f40_0
- intel-openmp=2019.0=118
- kiwisolver=1.0.1=py36h0a44026_0
- libcxx=4.0.1=h579ed51_0
- libcxxabi=4.0.1=hebd6815_0
- libedit=3.1.20170329=hb402a30_2
- libffi=3.2.1=h475c297_4
- libgfortran=3.0.1=h93005f0_2
- libopenblas=0.2.20=hdc02c5d_7
- libpng=1.6.34=he12f830_0
- matplotlib=3.0.0=py36h54f8f79_0
- mkl=2019.0=118
- mkl_fft=1.0.6=py36hb8a8100_0
- mkl_random=1.0.1=py36h5d10147_1
- ncurses=6.1=h0a44026_0
- numpy=1.15.2=py36h6a91979_0
- numpy-base=1.15.2=py36h8a80b8c_0
- openssl=1.0.2p=h1de35cc_0
- pip=10.0.1=py36_0
- pyparsing=2.2.0=py36_1
- python=3.6.6=hc167b69_0
- python-dateutil=2.7.3=py36_0
- pytz=2018.5=py36_0
- readline=7.0=hc1231fa_4
- setuptools=40.0.0=py36_0
- six=1.11.0=py36_1
- sqlite=3.24.0=ha441bb4_0
- tk=8.6.7=h35a86e2_3
- tornado=5.1=py36h1de35cc_0
- wheel=0.31.1=py36_0
- xz=5.2.4=h1de35cc_4
- zlib=1.2.11=hf3cbc9b_2
- pip:
- absl-py==0.4.0
- apipkg==1.5
- astor==0.7.1
- atomicwrites==1.2.1
- attrs==18.2.0
- bleach==1.5.0
- click==6.7
- configparser==3.5.0
- decorator==4.3.0
- deprecated==1.2.1
- dicom2nifti==2.0.3
- et-xmlfile==1.0.1
- execnet==1.5.0
- funcsigs==1.0.2
- future==0.16.0
- gast==0.2.0
- graphviz==0.9
- grpcio==1.14.1
- h5py==2.8.0
- html5lib==0.9999999
- isodate==0.6.0
- jdcal==1.4
- keras==2.1.6
- lxml==4.2.5
- markdown==2.6.11
- mock==2.0.0
- more-itertools==4.3.0
- mpmath==1.0.0
- natsort==5.3.3
- networkx==2.1
- nibabel==2.3.0
- nipy==0.4.2
- nipype==1.1.2
- opencv-python==3.4.2.17
- openpyxl==2.5.8
- packaging==17.1
- pandas==0.23.4
- pbr==4.2.0
- pillow==5.2.0
- pluggy==0.7.1
- protobuf==3.6.1
- prov==1.5.0
- psutil==5.4.7
- py==1.6.0
- pydicom==1.1.0
- pydot==1.2.4
- pydotplus==2.0.2
- pytest==3.8.0
- pytest-forked==0.2
- pytest-xdist==1.23.0
- pywavelets==0.5.2
- pyyaml==3.13
- rdflib==4.2.2
- scikit-image==0.13.1
- scipy==1.1.0
- simpleitk==1.1.0
- simplejson==3.16.0
- sympy==1.3
- tensorboard==1.8.0
- tensorflow==1.8.0
- termcolor==1.1.0
- traits==4.6.0
- werkzeug==0.14.1
- wrapt==1.10.11
- boost=1.68.0=py36h3e44d54_0
- boost-cpp=1.68.0=h3a22d5f_0
- bzip2=1.0.6=1
- icu=58.2=hfc679d8_0
- blas=1.0=mkl
- ca-certificates=2018.03.07=0
- certifi=2018.8.24=py36_1
- cycler=0.10.0=py36hfc81398_0
- freetype=2.9.1=hb4e5f40_0
- intel-openmp=2019.0=118
- kiwisolver=1.0.1=py36h0a44026_0
- libcxx=4.0.1=h579ed51_0
- libcxxabi=4.0.1=hebd6815_0
- libedit=3.1.20170329=hb402a30_2
- libffi=3.2.1=h475c297_4
- libgfortran=3.0.1=h93005f0_2
- libopenblas=0.2.20=hdc02c5d_7
- libpng=1.6.34=he12f830_0
- matplotlib=3.0.0=py36h54f8f79_0
- mkl=2019.0=118
- mkl_fft=1.0.6=py36hb8a8100_0
- mkl_random=1.0.1=py36h5d10147_1
- ncurses=6.1=h0a44026_0
- numpy=1.15.2=py36h6a91979_0
- numpy-base=1.15.2=py36h8a80b8c_0
- openssl=1.0.2p=h1de35cc_0
- pip=10.0.1=py36_0
- pyparsing=2.2.0=py36_1
- python=3.6.6=hc167b69_0
- python-dateutil=2.7.3=py36_0
- pytz=2018.5=py36_0
- readline=7.0=hc1231fa_4
- setuptools=40.0.0=py36_0
- six=1.11.0=py36_1
- sqlite=3.24.0=ha441bb4_0
- tk=8.6.7=h35a86e2_3
- tornado=5.1=py36h1de35cc_0
- wheel=0.31.1=py36_0
- xz=5.2.4=h1de35cc_4
- zlib=1.2.11=hf3cbc9b_2
- pip:
- absl-py==0.4.0
- apipkg==1.5
- astor==0.7.1
- atomicwrites==1.2.1
- attrs==18.2.0
- bleach==1.5.0
- click==6.7
- configparser==3.5.0
- decorator==4.3.0
- deprecated==1.2.1
- dicom2nifti==2.0.3
- et-xmlfile==1.0.1
- execnet==1.5.0
- funcsigs==1.0.2
- future==0.16.0
- gast==0.2.0
- graphviz==0.9
- grpcio==1.14.1
- h5py==2.8.0
- html5lib==0.9999999
- isodate==0.6.0
- jdcal==1.4
- keras==2.1.6
- lxml==4.2.5
- markdown==2.6.11
- mock==2.0.0
- more-itertools==4.3.0
- mpmath==1.0.0
- natsort==5.3.3
- networkx==2.1
- nibabel==2.3.0
- nipy==0.4.2
- nipype==1.1.2
- opencv-python==3.4.2.17
- openpyxl==2.5.8
- packaging==17.1
- pandas==0.23.4
- pbr==4.2.0
- pillow==5.2.0
- pluggy==0.7.1
- protobuf==3.6.1
- prov==1.5.0
- psutil==5.4.7
- py==1.6.0
- pydicom==1.1.0
- pydot==1.2.4
- pydotplus==2.0.2
- pytest==3.8.0
- pytest-forked==0.2
- pytest-xdist==1.23.0
- pywavelets==0.5.2
- pyyaml==3.13
- rdflib==4.2.2
- scikit-image==0.13.1
- scipy==1.1.0
- simpleitk==1.1.0
- simplejson==3.16.0
- sympy==1.3
- tensorboard==1.8.0
- tensorflow==1.8.0
- termcolor==1.1.0
- traits==4.6.0
- werkzeug==0.14.1
- wrapt==1.10.11
prefix: /Users/arjundesai/anaconda3/envs/tf
9 changes: 7 additions & 2 deletions file_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@
ELASTIX_BSPLINE_PARAMS_FILE = os.path.join(__PATH_TO_ELASTIX_FOLDER__, 'parameters-bspline.txt')
ELASTIX_RIGID_PARAMS_FILE = os.path.join(__PATH_TO_ELASTIX_FOLDER__, 'parameters-rigid.txt')

ELASTIX_AFFINE_INTERREGISTER_PARAMS_FILE = os.path.join(__PATH_TO_ELASTIX_FOLDER__,
'parameters-affine-interregister.txt')
ELASTIX_RIGID_INTERREGISTER_PARAMS_FILE = os.path.join(__PATH_TO_ELASTIX_FOLDER__,
'parameters-rigid-intraregister.txt')

# Temporary file path
TEMP_FOLDER_PATH = os.path.join(__DIR__, 'temp')

# TODO: nipype logging
NIPYPE_LOGGING = 'none'


def set_debug():
global DEBUG, NIPYPE_LOGGING
DEBUG=1
NIPYPE_LOGGING = 'stream'
DEBUG = 1
NIPYPE_LOGGING = 'stream'
Empty file added med_objects/__init__.py
Empty file.
Loading

0 comments on commit 070b652

Please sign in to comment.