diff --git a/Python/01_Image_Basics.ipynb b/Python/01_Image_Basics.ipynb index 8df29a37..d2b1e58a 100644 --- a/Python/01_Image_Basics.ipynb +++ b/Python/01_Image_Basics.ipynb @@ -28,10 +28,10 @@ " import google.colab\n", " import pathlib\n", "\n", - " repo_dir = pathlib.Path(\"SimpleITK-Notebooks\")\n", + " repo_dir = pathlib.Path(\"/content/SimpleITK-Notebooks\")\n", " if not repo_dir.exists():\n", " !git clone --depth 1 https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", - " %cd SimpleITK-Notebooks/Python\n", + " %cd /content/SimpleITK-Notebooks/Python\n", " !pip install -q -r requirements.txt\n", "\n", "except ImportError:\n", diff --git a/Python/02_Pythonic_Image.ipynb b/Python/02_Pythonic_Image.ipynb index 9f0dfd17..6c6092c9 100644 --- a/Python/02_Pythonic_Image.ipynb +++ b/Python/02_Pythonic_Image.ipynb @@ -23,12 +23,19 @@ "outputs": [], "source": [ "# Setup to enable running the notebook in the Google Colab environment\n", - "import os\n", "\n", - "if \"COLAB_NOTEBOOK_ID\" in os.environ:\n", - " !git clone https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", - " %cd SimpleITK-Notebooks/Python\n", - " !pip install -q -r requirements.txt" + "try:\n", + " import google.colab\n", + " import pathlib\n", + "\n", + " repo_dir = pathlib.Path(\"/content/SimpleITK-Notebooks\")\n", + " if not repo_dir.exists():\n", + " !git clone --depth 1 https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", + " %cd /content/SimpleITK-Notebooks/Python\n", + " !pip install -q -r requirements.txt\n", + "\n", + "except ImportError:\n", + " pass # not on Colab" ] }, { diff --git a/Python/03_Image_Details.ipynb b/Python/03_Image_Details.ipynb index 483260d0..7a687cc5 100644 --- a/Python/03_Image_Details.ipynb +++ b/Python/03_Image_Details.ipynb @@ -23,12 +23,19 @@ "outputs": [], "source": [ "# Setup to enable running the notebook in the Google Colab environment\n", - "import os\n", "\n", - "if \"COLAB_NOTEBOOK_ID\" in os.environ:\n", - " !git clone https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", - " %cd SimpleITK-Notebooks/Python\n", - " !pip install -q -r requirements.txt" + "try:\n", + " import google.colab\n", + " import pathlib\n", + "\n", + " repo_dir = pathlib.Path(\"/content/SimpleITK-Notebooks\")\n", + " if not repo_dir.exists():\n", + " !git clone --depth 1 https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", + " %cd /content/SimpleITK-Notebooks/Python\n", + " !pip install -q -r requirements.txt\n", + "\n", + "except ImportError:\n", + " pass # not on Colab" ] }, { diff --git a/Python/04_Image_Display.ipynb b/Python/04_Image_Display.ipynb index 91cb5e03..77e9ac82 100644 --- a/Python/04_Image_Display.ipynb +++ b/Python/04_Image_Display.ipynb @@ -23,12 +23,19 @@ "outputs": [], "source": [ "# Setup to enable running the notebook in the Google Colab environment\n", - "import os\n", "\n", - "if \"COLAB_NOTEBOOK_ID\" in os.environ:\n", - " !git clone https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", - " %cd SimpleITK-Notebooks/Python\n", - " !pip install -q -r requirements.txt" + "try:\n", + " import google.colab\n", + " import pathlib\n", + "\n", + " repo_dir = pathlib.Path(\"/content/SimpleITK-Notebooks\")\n", + " if not repo_dir.exists():\n", + " !git clone --depth 1 https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", + " %cd /content/SimpleITK-Notebooks/Python\n", + " !pip install -q -r requirements.txt\n", + "\n", + "except ImportError:\n", + " pass # not on Colab" ] }, { diff --git a/Python/05_Results_Visualization.ipynb b/Python/05_Results_Visualization.ipynb index 4969dc0d..721e45ba 100644 --- a/Python/05_Results_Visualization.ipynb +++ b/Python/05_Results_Visualization.ipynb @@ -23,12 +23,19 @@ "outputs": [], "source": [ "# Setup to enable running the notebook in the Google Colab environment\n", - "import os\n", "\n", - "if \"COLAB_NOTEBOOK_ID\" in os.environ:\n", - " !git clone https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", - " %cd SimpleITK-Notebooks/Python\n", - " !pip install -q -r requirements.txt" + "try:\n", + " import google.colab\n", + " import pathlib\n", + "\n", + " repo_dir = pathlib.Path(\"/content/SimpleITK-Notebooks\")\n", + " if not repo_dir.exists():\n", + " !git clone --depth 1 https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", + " %cd /content/SimpleITK-Notebooks/Python\n", + " !pip install -q -r requirements.txt\n", + "\n", + "except ImportError:\n", + " pass # not on Colab" ] }, { diff --git a/Python/10_matplotlibs_imshow.ipynb b/Python/10_matplotlibs_imshow.ipynb index 17dfe13b..9ce1ae91 100644 --- a/Python/10_matplotlibs_imshow.ipynb +++ b/Python/10_matplotlibs_imshow.ipynb @@ -23,12 +23,19 @@ "outputs": [], "source": [ "# Setup to enable running the notebook in the Google Colab environment\n", - "import os\n", "\n", - "if \"COLAB_NOTEBOOK_ID\" in os.environ:\n", - " !git clone https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", - " %cd SimpleITK-Notebooks/Python\n", - " !pip install -q -r requirements.txt" + "try:\n", + " import google.colab\n", + " import pathlib\n", + "\n", + " repo_dir = pathlib.Path(\"/content/SimpleITK-Notebooks\")\n", + " if not repo_dir.exists():\n", + " !git clone --depth 1 https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", + " %cd /content/SimpleITK-Notebooks/Python\n", + " !pip install -q -r requirements.txt\n", + "\n", + "except ImportError:\n", + " pass # not on Colab" ] }, { diff --git a/Python/11_Progress.ipynb b/Python/11_Progress.ipynb index c059a61b..501e6023 100644 --- a/Python/11_Progress.ipynb +++ b/Python/11_Progress.ipynb @@ -23,12 +23,19 @@ "outputs": [], "source": [ "# Setup to enable running the notebook in the Google Colab environment\n", - "import os\n", "\n", - "if \"COLAB_NOTEBOOK_ID\" in os.environ:\n", - " !git clone https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", - " %cd SimpleITK-Notebooks/Python\n", - " !pip install -q -r requirements.txt" + "try:\n", + " import google.colab\n", + " import pathlib\n", + "\n", + " repo_dir = pathlib.Path(\"/content/SimpleITK-Notebooks\")\n", + " if not repo_dir.exists():\n", + " !git clone --depth 1 https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", + " %cd /content/SimpleITK-Notebooks/Python\n", + " !pip install -q -r requirements.txt\n", + "\n", + "except ImportError:\n", + " pass # not on Colab" ] }, { diff --git a/Python/20_Expand_With_Interpolators.ipynb b/Python/20_Expand_With_Interpolators.ipynb index 14bfee3c..2cc9dc9b 100644 --- a/Python/20_Expand_With_Interpolators.ipynb +++ b/Python/20_Expand_With_Interpolators.ipynb @@ -23,12 +23,19 @@ "outputs": [], "source": [ "# Setup to enable running the notebook in the Google Colab environment\n", - "import os\n", "\n", - "if \"COLAB_NOTEBOOK_ID\" in os.environ:\n", - " !git clone https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", - " %cd SimpleITK-Notebooks/Python\n", - " !pip install -q -r requirements.txt" + "try:\n", + " import google.colab\n", + " import pathlib\n", + "\n", + " repo_dir = pathlib.Path(\"/content/SimpleITK-Notebooks\")\n", + " if not repo_dir.exists():\n", + " !git clone --depth 1 https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", + " %cd /content/SimpleITK-Notebooks/Python\n", + " !pip install -q -r requirements.txt\n", + "\n", + "except ImportError:\n", + " pass # not on Colab" ] }, { diff --git a/Python/21_Transforms_and_Resampling.ipynb b/Python/21_Transforms_and_Resampling.ipynb index 18f56bd6..ec9c83c1 100644 --- a/Python/21_Transforms_and_Resampling.ipynb +++ b/Python/21_Transforms_and_Resampling.ipynb @@ -23,12 +23,19 @@ "outputs": [], "source": [ "# Setup to enable running the notebook in the Google Colab environment\n", - "import os\n", "\n", - "if \"COLAB_NOTEBOOK_ID\" in os.environ:\n", - " !git clone https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", - " %cd SimpleITK-Notebooks/Python\n", - " !pip install -q -r requirements.txt" + "try:\n", + " import google.colab\n", + " import pathlib\n", + "\n", + " repo_dir = pathlib.Path(\"/content/SimpleITK-Notebooks\")\n", + " if not repo_dir.exists():\n", + " !git clone --depth 1 https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", + " %cd /content/SimpleITK-Notebooks/Python\n", + " !pip install -q -r requirements.txt\n", + "\n", + "except ImportError:\n", + " pass # not on Colab" ] }, { diff --git a/Python/22_Transforms.ipynb b/Python/22_Transforms.ipynb index c459f803..1339469d 100644 --- a/Python/22_Transforms.ipynb +++ b/Python/22_Transforms.ipynb @@ -23,12 +23,19 @@ "outputs": [], "source": [ "# Setup to enable running the notebook in the Google Colab environment\n", - "import os\n", "\n", - "if \"COLAB_NOTEBOOK_ID\" in os.environ:\n", - " !git clone https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", - " %cd SimpleITK-Notebooks/Python\n", - " !pip install -q -r requirements.txt" + "try:\n", + " import google.colab\n", + " import pathlib\n", + "\n", + " repo_dir = pathlib.Path(\"/content/SimpleITK-Notebooks\")\n", + " if not repo_dir.exists():\n", + " !git clone --depth 1 https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", + " %cd /content/SimpleITK-Notebooks/Python\n", + " !pip install -q -r requirements.txt\n", + "\n", + "except ImportError:\n", + " pass # not on Colab" ] }, { diff --git a/Python/300_Segmentation_Overview.ipynb b/Python/300_Segmentation_Overview.ipynb index 87283135..dd011595 100644 --- a/Python/300_Segmentation_Overview.ipynb +++ b/Python/300_Segmentation_Overview.ipynb @@ -23,12 +23,19 @@ "outputs": [], "source": [ "# Setup to enable running the notebook in the Google Colab environment\n", - "import os\n", "\n", - "if \"COLAB_NOTEBOOK_ID\" in os.environ:\n", - " !git clone https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", - " %cd SimpleITK-Notebooks/Python\n", - " !pip install -q -r requirements.txt" + "try:\n", + " import google.colab\n", + " import pathlib\n", + "\n", + " repo_dir = pathlib.Path(\"/content/SimpleITK-Notebooks\")\n", + " if not repo_dir.exists():\n", + " !git clone --depth 1 https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", + " %cd /content/SimpleITK-Notebooks/Python\n", + " !pip install -q -r requirements.txt\n", + "\n", + "except ImportError:\n", + " pass # not on Colab" ] }, { diff --git a/Python/30_Segmentation_Region_Growing.ipynb b/Python/30_Segmentation_Region_Growing.ipynb index 9bcc791c..2beea88f 100644 --- a/Python/30_Segmentation_Region_Growing.ipynb +++ b/Python/30_Segmentation_Region_Growing.ipynb @@ -23,12 +23,19 @@ "outputs": [], "source": [ "# Setup to enable running the notebook in the Google Colab environment\n", - "import os\n", "\n", - "if \"COLAB_NOTEBOOK_ID\" in os.environ:\n", - " !git clone https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", - " %cd SimpleITK-Notebooks/Python\n", - " !pip install -q -r requirements.txt" + "try:\n", + " import google.colab\n", + " import pathlib\n", + "\n", + " repo_dir = pathlib.Path(\"/content/SimpleITK-Notebooks\")\n", + " if not repo_dir.exists():\n", + " !git clone --depth 1 https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", + " %cd /content/SimpleITK-Notebooks/Python\n", + " !pip install -q -r requirements.txt\n", + "\n", + "except ImportError:\n", + " pass # not on Colab" ] }, { diff --git a/Python/31_Levelset_Segmentation.ipynb b/Python/31_Levelset_Segmentation.ipynb index e9469b4f..0ec4614c 100644 --- a/Python/31_Levelset_Segmentation.ipynb +++ b/Python/31_Levelset_Segmentation.ipynb @@ -23,12 +23,19 @@ "outputs": [], "source": [ "# Setup to enable running the notebook in the Google Colab environment\n", - "import os\n", "\n", - "if \"COLAB_NOTEBOOK_ID\" in os.environ:\n", - " !git clone https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", - " %cd SimpleITK-Notebooks/Python\n", - " !pip install -q -r requirements.txt" + "try:\n", + " import google.colab\n", + " import pathlib\n", + "\n", + " repo_dir = pathlib.Path(\"/content/SimpleITK-Notebooks\")\n", + " if not repo_dir.exists():\n", + " !git clone --depth 1 https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", + " %cd /content/SimpleITK-Notebooks/Python\n", + " !pip install -q -r requirements.txt\n", + "\n", + "except ImportError:\n", + " pass # not on Colab" ] }, { diff --git a/Python/32_Watersheds_Segmentation.ipynb b/Python/32_Watersheds_Segmentation.ipynb index 3928821f..b5e7095b 100644 --- a/Python/32_Watersheds_Segmentation.ipynb +++ b/Python/32_Watersheds_Segmentation.ipynb @@ -23,12 +23,19 @@ "outputs": [], "source": [ "# Setup to enable running the notebook in the Google Colab environment\n", - "import os\n", "\n", - "if \"COLAB_NOTEBOOK_ID\" in os.environ:\n", - " !git clone https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", - " %cd SimpleITK-Notebooks/Python\n", - " !pip install -q -r requirements.txt" + "try:\n", + " import google.colab\n", + " import pathlib\n", + "\n", + " repo_dir = pathlib.Path(\"/content/SimpleITK-Notebooks\")\n", + " if not repo_dir.exists():\n", + " !git clone --depth 1 https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", + " %cd /content/SimpleITK-Notebooks/Python\n", + " !pip install -q -r requirements.txt\n", + "\n", + "except ImportError:\n", + " pass # not on Colab" ] }, { diff --git a/Python/33_Segmentation_Thresholding_Edge_Detection.ipynb b/Python/33_Segmentation_Thresholding_Edge_Detection.ipynb index a533524e..0f67cfcb 100644 --- a/Python/33_Segmentation_Thresholding_Edge_Detection.ipynb +++ b/Python/33_Segmentation_Thresholding_Edge_Detection.ipynb @@ -23,12 +23,19 @@ "outputs": [], "source": [ "# Setup to enable running the notebook in the Google Colab environment\n", - "import os\n", "\n", - "if \"COLAB_NOTEBOOK_ID\" in os.environ:\n", - " !git clone https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", - " %cd SimpleITK-Notebooks/Python\n", - " !pip install -q -r requirements.txt" + "try:\n", + " import google.colab\n", + " import pathlib\n", + "\n", + " repo_dir = pathlib.Path(\"/content/SimpleITK-Notebooks\")\n", + " if not repo_dir.exists():\n", + " !git clone --depth 1 https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", + " %cd /content/SimpleITK-Notebooks/Python\n", + " !pip install -q -r requirements.txt\n", + "\n", + "except ImportError:\n", + " pass # not on Colab" ] }, { diff --git a/Python/34_Segmentation_Evaluation.ipynb b/Python/34_Segmentation_Evaluation.ipynb index ada74379..8879f8f9 100644 --- a/Python/34_Segmentation_Evaluation.ipynb +++ b/Python/34_Segmentation_Evaluation.ipynb @@ -23,12 +23,19 @@ "outputs": [], "source": [ "# Setup to enable running the notebook in the Google Colab environment\n", - "import os\n", "\n", - "if \"COLAB_NOTEBOOK_ID\" in os.environ:\n", - " !git clone https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", - " %cd SimpleITK-Notebooks/Python\n", - " !pip install -q -r requirements.txt" + "try:\n", + " import google.colab\n", + " import pathlib\n", + "\n", + " repo_dir = pathlib.Path(\"/content/SimpleITK-Notebooks\")\n", + " if not repo_dir.exists():\n", + " !git clone --depth 1 https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", + " %cd /content/SimpleITK-Notebooks/Python\n", + " !pip install -q -r requirements.txt\n", + "\n", + "except ImportError:\n", + " pass # not on Colab" ] }, { diff --git a/Python/60_Registration_Introduction.ipynb b/Python/60_Registration_Introduction.ipynb index 3099e42f..ed1b9674 100644 --- a/Python/60_Registration_Introduction.ipynb +++ b/Python/60_Registration_Introduction.ipynb @@ -23,12 +23,19 @@ "outputs": [], "source": [ "# Setup to enable running the notebook in the Google Colab environment\n", - "import os\n", "\n", - "if \"COLAB_NOTEBOOK_ID\" in os.environ:\n", - " !git clone https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", - " %cd SimpleITK-Notebooks/Python\n", - " !pip install -q -r requirements.txt" + "try:\n", + " import google.colab\n", + " import pathlib\n", + "\n", + " repo_dir = pathlib.Path(\"/content/SimpleITK-Notebooks\")\n", + " if not repo_dir.exists():\n", + " !git clone --depth 1 https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", + " %cd /content/SimpleITK-Notebooks/Python\n", + " !pip install -q -r requirements.txt\n", + "\n", + "except ImportError:\n", + " pass # not on Colab" ] }, { @@ -53,28 +60,28 @@ "### Optimizers\n", "\n", "Several optimizer types are supported via the `SetOptimizerAsX()` methods. These include:\n", - "* [Exhaustive](http://www.itk.org/Doxygen/html/classitk_1_1ExhaustiveOptimizerv4.html)\n", - "* [Nelder-Mead downhill simplex](http://www.itk.org/Doxygen/html/classitk_1_1AmoebaOptimizerv4.html), a.k.a. Amoeba\n", - "* [Powell optimizer](https://itk.org/Doxygen/html/classitk_1_1PowellOptimizerv4.html)\n", - "* [1+1 evolutionary optimizer](https://itk.org/Doxygen/html/classitk_1_1OnePlusOneEvolutionaryOptimizerv4.html)\n", + "* [Exhaustive](https://docs.itk.org/projects/doxygen/en/stable/classitk_1_1ExhaustiveOptimizerv4.html)\n", + "* [Nelder-Mead downhill simplex](https://docs.itk.org/projects/doxygen/en/stable/classitk_1_1AmoebaOptimizerv4.html), a.k.a. Amoeba\n", + "* [Powell optimizer](https://docs.itk.org/projects/doxygen/en/stable/classitk_1_1PowellOptimizerv4.html)\n", + "* [1+1 evolutionary optimizer](https://docs.itk.org/projects/doxygen/en/stable/classitk_1_1OnePlusOneEvolutionaryOptimizerv4.html)\n", "* Variations on gradient descent:\n", - " * [GradientDescent](http://www.itk.org/Doxygen/html/classitk_1_1GradientDescentOptimizerv4Template.html)\n", - " * [GradientDescentLineSearch](http://www.itk.org/Doxygen/html/classitk_1_1GradientDescentLineSearchOptimizerv4Template.html)\n", - " * [RegularStepGradientDescent](http://www.itk.org/Doxygen/html/classitk_1_1RegularStepGradientDescentOptimizerv4.html)\n", - "* [ConjugateGradientLineSearch](http://www.itk.org/Doxygen/html/classitk_1_1ConjugateGradientLineSearchOptimizerv4Template.html)\n", - "* [L-BFGS2](https://itk.org/Doxygen/html/classitk_1_1LBFGS2Optimizerv4.html) (Limited memory Broyden, Fletcher, Goldfarb, Shannon)\n", - "* [L-BFGS-B](http://www.itk.org/Doxygen/html/classitk_1_1LBFGSBOptimizerv4.html) (Limited memory Broyden, Fletcher, Goldfarb, Shannon - Bound Constrained) - supports the use of simple constraints.\n", + " * [GradientDescent](https://docs.itk.org/projects/doxygen/en/stable/classitk_1_1GradientDescentOptimizerv4Template.html)\n", + " * [GradientDescentLineSearch](https://docs.itk.org/projects/doxygen/en/stable/classitk_1_1GradientDescentLineSearchOptimizerv4Template.html)\n", + " * [RegularStepGradientDescent](https://docs.itk.org/projects/doxygen/en/stable/classitk_1_1RegularStepGradientDescentOptimizerv4.html)\n", + "* [ConjugateGradientLineSearch](https://docs.itk.org/projects/doxygen/en/stable/classitk_1_1ConjugateGradientLineSearchOptimizerv4Template.html)\n", + "* [L-BFGS2](https://docs.itk.org/projects/doxygen/en/stable/classitk_1_1LBFGS2Optimizerv4Template.html) (Limited memory Broyden, Fletcher, Goldfarb, Shannon)\n", + "* [L-BFGS-B](https://docs.itk.org/projects/doxygen/en/stable/classitk_1_1LBFGSBOptimizerv4.html) (Limited memory Broyden, Fletcher, Goldfarb, Shannon - Bound Constrained) - supports the use of simple constraints.\n", "\n", "\n", "### Similarity metrics\n", "\n", "Several metric types are supported via the `SetMetricAsX()` methods. These include:\n", - "* [MeanSquares](http://www.itk.org/Doxygen/html/classitk_1_1MeanSquaresImageToImageMetricv4.html)\n", - "* [Demons](http://www.itk.org/Doxygen/html/classitk_1_1DemonsImageToImageMetricv4.html)\n", - "* [Correlation](http://www.itk.org/Doxygen/html/classitk_1_1CorrelationImageToImageMetricv4.html)\n", - "* [ANTSNeighborhoodCorrelation](http://www.itk.org/Doxygen/html/classitk_1_1ANTSNeighborhoodCorrelationImageToImageMetricv4.html)\n", - "* [JointHistogramMutualInformation](http://www.itk.org/Doxygen/html/classitk_1_1JointHistogramMutualInformationImageToImageMetricv4.html)\n", - "* [MattesMutualInformation](http://www.itk.org/Doxygen/html/classitk_1_1MattesMutualInformationImageToImageMetricv4.html)\n", + "* [MeanSquares](https://docs.itk.org/projects/doxygen/en/stable/classitk_1_1MeanSquaresImageToImageMetricv4.html)\n", + "* [Demons](https://docs.itk.org/projects/doxygen/en/stable/classitk_1_1DemonsImageToImageMetricv4.html)\n", + "* [Correlation](https://docs.itk.org/projects/doxygen/en/stable/classitk_1_1CorrelationImageToImageMetricv4.html)\n", + "* [ANTSNeighborhoodCorrelation](https://docs.itk.org/projects/doxygen/en/stable/classitk_1_1ANTSNeighborhoodCorrelationImageToImageMetricv4.html)\n", + "* [JointHistogramMutualInformation](https://docs.itk.org/projects/doxygen/en/stable/classitk_1_1JointHistogramMutualInformationImageToImageMetricv4.html)\n", + "* [MattesMutualInformation](https://docs.itk.org/projects/doxygen/en/stable/classitk_1_1MattesMutualInformationImageToImageMetricv4.html)\n", "\n", "\n", "### Interpolators\n", diff --git a/Python/62_Registration_Tuning.ipynb b/Python/62_Registration_Tuning.ipynb index 3381013e..f2ca1741 100644 --- a/Python/62_Registration_Tuning.ipynb +++ b/Python/62_Registration_Tuning.ipynb @@ -23,12 +23,19 @@ "outputs": [], "source": [ "# Setup to enable running the notebook in the Google Colab environment\n", - "import os\n", "\n", - "if \"COLAB_NOTEBOOK_ID\" in os.environ:\n", - " !git clone https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", - " %cd SimpleITK-Notebooks/Python\n", - " !pip install -q -r requirements.txt" + "try:\n", + " import google.colab\n", + " import pathlib\n", + "\n", + " repo_dir = pathlib.Path(\"/content/SimpleITK-Notebooks\")\n", + " if not repo_dir.exists():\n", + " !git clone --depth 1 https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", + " %cd /content/SimpleITK-Notebooks/Python\n", + " !pip install -q -r requirements.txt\n", + "\n", + "except ImportError:\n", + " pass # not on Colab" ] }, { diff --git a/Python/64_Registration_Memory_Time_Tradeoff.ipynb b/Python/64_Registration_Memory_Time_Tradeoff.ipynb index 1a77fd83..de77706c 100644 --- a/Python/64_Registration_Memory_Time_Tradeoff.ipynb +++ b/Python/64_Registration_Memory_Time_Tradeoff.ipynb @@ -23,12 +23,19 @@ "outputs": [], "source": [ "# Setup to enable running the notebook in the Google Colab environment\n", - "import os\n", "\n", - "if \"COLAB_NOTEBOOK_ID\" in os.environ:\n", - " !git clone https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", - " %cd SimpleITK-Notebooks/Python\n", - " !pip install -q -r requirements.txt" + "try:\n", + " import google.colab\n", + " import pathlib\n", + "\n", + " repo_dir = pathlib.Path(\"/content/SimpleITK-Notebooks\")\n", + " if not repo_dir.exists():\n", + " !git clone --depth 1 https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", + " %cd /content/SimpleITK-Notebooks/Python\n", + " !pip install -q -r requirements.txt\n", + "\n", + "except ImportError:\n", + " pass # not on Colab" ] }, { diff --git a/Python/67_Registration_Semiautomatic_Homework.ipynb b/Python/67_Registration_Semiautomatic_Homework.ipynb index d15e5f5a..012ef38e 100644 --- a/Python/67_Registration_Semiautomatic_Homework.ipynb +++ b/Python/67_Registration_Semiautomatic_Homework.ipynb @@ -23,12 +23,19 @@ "outputs": [], "source": [ "# Setup to enable running the notebook in the Google Colab environment\n", - "import os\n", "\n", - "if \"COLAB_NOTEBOOK_ID\" in os.environ:\n", - " !git clone https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", - " %cd SimpleITK-Notebooks/Python\n", - " !pip install -q -r requirements.txt" + "try:\n", + " import google.colab\n", + " import pathlib\n", + "\n", + " repo_dir = pathlib.Path(\"/content/SimpleITK-Notebooks\")\n", + " if not repo_dir.exists():\n", + " !git clone --depth 1 https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", + " %cd /content/SimpleITK-Notebooks/Python\n", + " !pip install -q -r requirements.txt\n", + "\n", + "except ImportError:\n", + " pass # not on Colab" ] }, { diff --git a/Python/68_Registration_Errors.ipynb b/Python/68_Registration_Errors.ipynb index 971173b8..161d7d92 100644 --- a/Python/68_Registration_Errors.ipynb +++ b/Python/68_Registration_Errors.ipynb @@ -23,12 +23,19 @@ "outputs": [], "source": [ "# Setup to enable running the notebook in the Google Colab environment\n", - "import os\n", "\n", - "if \"COLAB_NOTEBOOK_ID\" in os.environ:\n", - " !git clone https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", - " %cd SimpleITK-Notebooks/Python\n", - " !pip install -q -r requirements.txt" + "try:\n", + " import google.colab\n", + " import pathlib\n", + "\n", + " repo_dir = pathlib.Path(\"/content/SimpleITK-Notebooks\")\n", + " if not repo_dir.exists():\n", + " !git clone --depth 1 https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", + " %cd /content/SimpleITK-Notebooks/Python\n", + " !pip install -q -r requirements.txt\n", + "\n", + "except ImportError:\n", + " pass # not on Colab" ] }, { diff --git a/Python/69_x-ray-panorama.ipynb b/Python/69_x-ray-panorama.ipynb index 25b01e26..2ed024b6 100755 --- a/Python/69_x-ray-panorama.ipynb +++ b/Python/69_x-ray-panorama.ipynb @@ -23,12 +23,19 @@ "outputs": [], "source": [ "# Setup to enable running the notebook in the Google Colab environment\n", - "import os\n", "\n", - "if \"COLAB_NOTEBOOK_ID\" in os.environ:\n", - " !git clone https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", - " %cd SimpleITK-Notebooks/Python\n", - " !pip install -q -r requirements.txt" + "try:\n", + " import google.colab\n", + " import pathlib\n", + "\n", + " repo_dir = pathlib.Path(\"/content/SimpleITK-Notebooks\")\n", + " if not repo_dir.exists():\n", + " !git clone --depth 1 https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", + " %cd /content/SimpleITK-Notebooks/Python\n", + " !pip install -q -r requirements.txt\n", + "\n", + "except ImportError:\n", + " pass # not on Colab" ] }, { diff --git a/Python/70_Data_Augmentation.ipynb b/Python/70_Data_Augmentation.ipynb index 43e982d2..6cfcc93d 100755 --- a/Python/70_Data_Augmentation.ipynb +++ b/Python/70_Data_Augmentation.ipynb @@ -23,12 +23,19 @@ "outputs": [], "source": [ "# Setup to enable running the notebook in the Google Colab environment\n", - "import os\n", "\n", - "if \"COLAB_NOTEBOOK_ID\" in os.environ:\n", - " !git clone https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", - " %cd SimpleITK-Notebooks/Python\n", - " !pip install -q -r requirements.txt" + "try:\n", + " import google.colab\n", + " import pathlib\n", + "\n", + " repo_dir = pathlib.Path(\"/content/SimpleITK-Notebooks\")\n", + " if not repo_dir.exists():\n", + " !git clone --depth 1 https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks\n", + " %cd /content/SimpleITK-Notebooks/Python\n", + " !pip install -q -r requirements.txt\n", + "\n", + "except ImportError:\n", + " pass # not on Colab" ] }, {