Skip to content

Commit

Permalink
Merge branch 'master' into blockoperator-norms
Browse files Browse the repository at this point in the history
Signed-off-by: Margaret Duff <[email protected]>
  • Loading branch information
MargaretDuff authored Oct 9, 2023
2 parents 1ca3a2b + 2b3e2cd commit 4b541e7
Show file tree
Hide file tree
Showing 13 changed files with 637 additions and 228 deletions.
73 changes: 28 additions & 45 deletions .github/workflows/conda_and_docs_build.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
# -*- coding: utf-8 -*-
# Copyright 2021 United Kingdom Research and Innovation
# Copyright 2021 The University of Manchester

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Authors:
# CIL Developers, listed at: https://github.com/TomographicImaging/CIL/blob/master/NOTICE.txt

name: conda_and_docs_build

on:
release:
types: [published]
push:
branches: [ master ]
branches: [master]
tags:
- '**'
paths-ignore:
Expand All @@ -33,92 +31,77 @@ on:
- 'scripts/**'
- 'NOTICE.txt'
- 'README.md'

pull_request:
branches: [ master ]
branches: [master]
paths-ignore:
- 'CHANGELOG.md'
- 'CITATION.cff'
- 'LICENSE'
- 'scripts/**'
- 'NOTICE.txt'
- 'README.md'

jobs:
conda_build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3.1.0
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: conda-build
uses: paskino/[email protected]
with:
subDir: 'recipe'
channels: '-c conda-forge -c intel -c astra-toolbox -c ccpi'
subDir: recipe
channels: -c conda-forge -c intel -c ccpi
convert_win: false
convert_osx: false
test_pyver: 3.9
test_npver: 1.22
- name: Upload artifact of the conda package.
uses: actions/upload-artifact@v3.1.1
uses: actions/upload-artifact@v3
with:
name: cil-package
path: recipe/linux-64/cil*
docs_build:
needs: conda_build
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3.1.0
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: change directory
run: |
ls
- run: ls
- name: Download artifact of the conda package.
uses: actions/download-artifact@v3.0.1
uses: actions/download-artifact@v3
with:
name: 'cil-package'
name: cil-package
path: 'conda_package'
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.9
- uses: lauramurgatroyd/[email protected]
with:
DOCS_PATH: 'docs'
CONDA_BUILD_ENV_FILEPATH: 'docs/docs_environment.yml'
ARTIFACT_NAME: 'DocumentationHTML'
PACKAGE_FOLDER_PATH: 'conda_package'
PACKAGE_NAME: 'cil'
PACKAGE_CONDA_CHANNELS: 'conda-forge -c intel -c astra-toolbox -c ccpi'
BUILD_SUBDIR_NAME: 'nightly'
DOCS_PATH: docs
CONDA_BUILD_ENV_FILEPATH: docs/docs_environment.yml
ARTIFACT_NAME: DocumentationHTML
PACKAGE_FOLDER_PATH: conda_package
PACKAGE_NAME: cil
PACKAGE_CONDA_CHANNELS: conda-forge -c intel -c ccpi
BUILD_SUBDIR_NAME: nightly
python_version: 3.9
docs_publish:
needs: docs_build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download artifact of the html output.
uses: actions/download-artifact@v3.0.1
uses: actions/download-artifact@v3
with:
name: DocumentationHTML
path: docs/build
- name: Commit documentation changes
run: |
git clone https://github.com/TomographicImaging/CIL.git --branch gh-pages --single-branch gh-pages
cp -r docs/build/* gh-pages/
cd gh-pages
touch .nojekyll
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Update documentation" -a || true
# The above command will fail if no changes were present, so we ignore
# that.
- name: Push changes
uses: ad-m/github-push-[email protected]
uses: casperdcl/push-dir@v1
with:
message: Update documentation
branch: gh-pages
directory: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}

dir: docs/build
nojekyll: true
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@

* x.x.x
* 23.1.0
- Fix bug in IndicatorBox proximal_conjugate
- Allow CCPi Regulariser functions for non CIL object
- Add norm for CompositionOperator
- Refactor SIRT algorithm to make it more computationally and memory efficient
- Optimisation in L2NormSquared
- Added support for partitioner, when partitions have size 1
- Fix for show_geometry bug for 2D data
- FBP split processing bug fix - now respects panel origin set in geometry
- Binner/Padder/Slicer bug fix - now respects panel origin set in geometry
- Added warmstart capability to proximal evaluation of the CIL TotalVariation function.
- FBP split processing bug fix - now respects panel origin
- Bug fix in the LinearOperator norm with an additional flag for the algorithm linearOperator.PowerMethod
- Tidied up documentation in the framework folder


* 23.0.1
- Fix bug with NikonReader requiring ROI to be set in constructor.

Expand Down
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,23 @@ The documentation for CIL can be accessed [here](https://tomographicimaging.gith

# Installation of CIL

Binary installation of CIL can be done with `conda`. Install a new environment using:
Binary installation of CIL can be achieved with `conda` or `mamba`. `mamba`'s environment solver (`libmamba`) provides faster environment resolution so we recommend this route, although in many cases the default `conda` will still work but may be very slow.

`miniconda` is a minimal installer for `conda`. Installation instructions can be found [here](https://docs.conda.io/projects/miniconda/en/latest/).
You can then force your `conda` installation to use `libmamba` instructions are [here](https://www.anaconda.com/blog/a-faster-conda-for-a-growing-community).

Alternatively, `mamba` can be installed via [`miniforge`](https://github.com/conda-forge/miniforge) which is another minimal installer for `conda` with optional support for `mamba`. In this case replace `conda` with `mamba` in the below commands.

Install a new environment using:

```bash
conda create --name cil -c conda-forge -c intel -c ccpi cil=23.0.1
conda create --name cil -c conda-forge -c intel -c ccpi cil=23.1.0
```

To install CIL and the additional packages and plugins needed to run the [CIL demos](https://github.com/TomographicImaging/CIL-Demos) install the environment with:

```bash
conda create --name cil -c conda-forge -c intel -c ccpi cil=23.0.1 astra-toolbox tigre ccpi-regulariser tomophantom "ipywidgets<8"
conda create --name cil -c conda-forge -c intel -c ccpi cil=23.1.0 astra-toolbox tigre ccpi-regulariser tomophantom "ipywidgets<8"
```
where,

Expand Down
44 changes: 43 additions & 1 deletion Wrappers/Python/cil/framework/framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ def __init__ (self, dof):
@staticmethod
def create_vector(val):
try:
vec = numpy.asarray(val, dtype=numpy.float64).reshape(len(val))
vec = numpy.array(val, dtype=numpy.float64).reshape(len(val))
except:
raise ValueError("Can't convert to numpy array")

Expand Down Expand Up @@ -1984,6 +1984,48 @@ def configured(self):
configured = False
return configured

def shift_detector_in_plane(self,
pixel_offset,
direction='horizontal'):
"""
Adjusts the position of the detector in a specified direction within the imaging plane.
Parameters:
-----------
pixel_offset : float
The number of pixels to adjust the detector's position by.
direction : {'horizontal', 'vertical'}, optional
The direction in which to adjust the detector's position. Defaults to 'horizontal'.
Notes:
------
- If `direction` is 'horizontal':
- If the panel's origin is 'left', positive offsets translate the detector to the right.
- If the panel's origin is 'right', positive offsets translate the detector to the left.
- If `direction` is 'vertical':
- If the panel's origin is 'bottom', positive offsets translate the detector upward.
- If the panel's origin is 'top', positive offsets translate the detector downward.
Returns:
--------
None
"""

if direction == 'horizontal':
pixel_size = self.panel.pixel_size[0]
pixel_direction = self.system.detector.direction_x

elif direction == 'vertical':
pixel_size = self.panel.pixel_size[1]
pixel_direction = self.system.detector.direction_y

if 'bottom' in self.panel.origin or 'left' in self.panel.origin:
self.system.detector.position -= pixel_offset * pixel_direction * pixel_size
else:
self.system.detector.position += pixel_offset * pixel_direction * pixel_size


def __str__(self):
repres = ""
if self.configured:
Expand Down
Loading

0 comments on commit 4b541e7

Please sign in to comment.