Skip to content

Commit 76d0050

Browse files
Merge pull request #9 from brandonjnelsonFDA/python
merge commit
2 parents 1a22566 + 0482c5c commit 76d0050

File tree

13 files changed

+2860
-265
lines changed

13 files changed

+2860
-265
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ octave-workspace
1313
notebooks/data
1414
*.egg-info
1515
docs/build
16-
# Ignore Python bytecode and cache files

README.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ If required versions of Matlab or Octave are not available on your system (see h
4848

4949
.. code-block:: shell
5050
51-
git clone https://github.com/DIDSR/LCD_CT
52-
cd LCD_CT
51+
git clone https://github.com/DIDSR/LCD_CT
52+
cd LCD_CT
53+
conda env create --file environment.yml
54+
conda activate LCD_CT
5355
5456
2. *If neither Matlab or Octave are installed or do not meet the `version requirements`_, you can source `install.sh` to prepare a `conda <https://conda.io/projects/conda/en/latest/user-guide/install/index.html>`_ environment. Note: this can take about 10 minutes to complete.
5557

build/lib/LCD/LCD.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
"""
2+
Low Contrast Detectability (LCD)
3+
"""
4+
from pathlib import Path
5+
6+
from oct2py import octave
7+
import pandas as pd
8+
9+
def measure_LCD(sp_vol, sa_vol, sp_gt_vol, observers=None):
10+
curdir = Path(__file__).parent.absolute()
11+
# octave.cd('../../LCD_CT/src/LCD')
12+
signal_present_array = sp_vol.transpose(1, 2, 0)
13+
signal_absent_array = sa_vol.transpose(1, 2, 0)
14+
print(curdir)
15+
octave.pwd()
16+
octave.addpath(curdir / 'classes')
17+
octave.addpath(curdir / 'functions')
18+
res = octave.measure_LCD(signal_present_array, signal_absent_array, sp_gt_vol)
19+
res = {k: v.squeeze() for k, v in res.items()}
20+
return pd.DataFrame(res)

environment.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: LCD_CT
2+
3+
channels:
4+
- conda-forge
5+
- defaults
6+
7+
dependencies:
8+
- octave
9+
- cxx-compiler
10+
- pandas
11+
- tomli
12+
- numpy
13+
- oct2py
14+
- pytest
15+
- sphinx-tabs
16+
- pandoc
17+
- ipykernel
18+
- pip
19+
- pip:
20+
- "git+https://github.com/DIDSR/pediatricIQphantoms"
21+
- sphinxcontrib-svg2pdfconverter
22+
- nbsphinx

install.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
conda create --name octave -y && conda activate octave
1+
conda create --name octave -y
2+
conda activate octave
23
conda install -c conda-forge octave -y
34
conda install -c conda-forge cxx-compiler -y
45

0 commit comments

Comments
 (0)