SPDX-FileCopyrightText: Copyright (C) 2021-2023 Asmail Muftah MuftahA@cardiff.ac.uk, PhD student at Cardiff University
SPDX-FileCopyrightText: Copyright (C) 2020-2024 Frank C Langbein frank@langbein.org, Cardiff University
SPDX-FileCopyrightText: Copyright (C) 2020-2022 S Shermer lw1660@gmail.com, Swansea University
SPDX-License-Identifier: AGPL-3.0-or-later
Code for classification and segmentation of prostate cancer.
The main functions are in the pcanet module. We provide jupyter notebook and command line interfaces, as needed/used. The results are in separate repositories:
- https://qyber.black/ca/results-pcanet-models-classification Some repositories are submodules. Note that they may be quite large.
Also note that the data repositories may not be public due to distribution limitations.
These instructions are for Linux. Note that the code has only been tested on Linux and may not work on another platform.
- Clone the repository:
Check the clone url, as it may be different if you use a different repository, e.g. from a mirror or alternative versions for development, etc.
git clone git@qyber.black:ca/pca/code-pcanet.git pcanet - Navigate to the directory:
Make sure to select a branch or tag with
cd pcanetgit checkout BRANCH_OR_TAGfor a specific version instead of the main branch. - Update submodules:
Note, some of the sub-modules are quite large and may not be accessible (if we cannot distribute the data; sometimes you may be able to get the data from the original source and use the tools from code-qdicom-utilities to convert the original files to a suitable data format). It may also be best to set
git submodule update --init --recursiveGIT_LFS_SKIP_SMUDGE=1to avoid the large data files are downloaded via LFS and then pull only specific LFS files withgit lfs pull -I PATHthat you need. - Install the requirements:
Note that the requirements may need additional libraries, etc. to be installed on you system that pip does not add automatically. Also note, that some packages (in particular mahotas), may not be available at the requested version if you are using a more recent version of python (python3.10) - these packages can still be installed from source; obtain the sources and checkout the version requested and run
pip3 install -r requirements.txtpython3 setup.py install --prefix=~/.localor similar.
pca.pyis the command line interface to the code for some functionalities. See--helpoption for further information.augmentsub-command creates augmented datasets for classification and segmentation. Classification includes extracting patches cropped to a rectangular region. Default augmentation options are set in pcanet/augment.py for the two modes. The original sample is always included. If the augmentation factor is 1, then only the original sample is included.classifytrains various classifiers on the datasets. If the model specified already exists it only evaluates it on the dataset given.predictruns a given classifier on a dataset to predict results.viewshows augmentation dataset content.
None directly included in the package, but see submodules that may have some to analyse the results, etc.