Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docs and update cache action #49

Merged
merged 3 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
with:
version: '1'
- name: CacheArtifacts
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-artifacts
with:
Expand Down
9 changes: 5 additions & 4 deletions docs/lit/examples/1-overview.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ This page gives an overview of the Julia package

# Packages needed here.

using SPECTrecon
using SPECTrecon: plan_psf, psf_gauss, SPECTplan
using SPECTrecon: project, project!, backproject, backproject!
using MIRTjim: jim, prompt
using LinearAlgebra: mul!
using LinearMapsAA: LinearMapAA
Expand Down Expand Up @@ -218,10 +219,10 @@ mul!(tmp, A', views)
The pixel dimensions `deltas` can (and should!) be values with units.

Here is an example ... (todo)
=#

#using UnitfulRecipes
#using Unitful: mm
using UnitfulRecipes
using Unitful: mm
=#


# ## Projection view animation
Expand Down
2 changes: 1 addition & 1 deletion docs/lit/examples/2-rotate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This page explains the image rotation portion of the Julia package

# Packages needed here.

using SPECTrecon
using SPECTrecon: plan_rotate, imrotate!, imrotate_adj!
using MIRTjim: jim, prompt
using Plots: scatter, scatter!, plot!, default
default(markerstrokecolor=:auto, markersize=3)
Expand Down
2 changes: 1 addition & 1 deletion docs/lit/examples/3-psf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This page explains the PSF portion of the Julia package

# Packages needed here.

using SPECTrecon
using SPECTrecon: psf_gauss, plan_psf, fft_conv!, fft_conv_adj!
using MIRTjim: jim, prompt
using Plots: scatter, scatter!, plot!, default
default(markerstrokecolor=:auto, markersize=3)
Expand Down
2 changes: 1 addition & 1 deletion docs/lit/examples/4-mlem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This page illustrates ML-EM reconstruction with the Julia package

# Packages needed here.

using SPECTrecon
using SPECTrecon: SPECTplan, psf_gauss, project!, backproject!, mlem, mlem!
using MIRTjim: jim, prompt
using Plots: scatter, plot!, default; default(markerstrokecolor=:auto)

Expand Down
3 changes: 2 additions & 1 deletion docs/lit/examples/5-2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ using the Julia package

# Packages needed here.

using SPECTrecon
using SPECTrecon: SPECTplan, psf_gauss
using SPECTrecon: project, project!, backproject, backproject!
using MIRTjim: jim, prompt
using ImagePhantoms: shepp_logan, SheppLoganEmis
using LinearAlgebra: mul!
Expand Down
51 changes: 31 additions & 20 deletions docs/lit/examples/6-dl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,26 +219,37 @@ end
# Initial loss
@show loss(xhat1, xtrue)

# ### Train the CNN
# Uncomment the following code to train!
## using Printf
## nepoch = 200
## for e = 1:nepoch
## @printf("epoch = %d, loss = %.2f\n", e, loss(xhat1, xtrue))
## ps = Flux.params(cnn)
## gs = gradient(ps) do
## loss(xhat1, xtrue) # we start with the 30 iteration EM reconstruction
## end
## opt = ADAMW(0.002)
## Flux.Optimise.update!(opt, ps, gs)
## end

# Uncomment to save your trained model.
## file = "../data/trained-cnn-example-6-dl.bson" # adjust path/name as needed
## @save file cnn

# Load the pre-trained model (uncomment if you save your own model).
## @load file cnn
#=
### Train the CNN
Uncomment the following code to train:

```
using Printf
nepoch = 200
for e in 1:nepoch
@printf("epoch = %d, loss = %.2f\n", e, loss(xhat1, xtrue))
ps = Flux.params(cnn)
gs = gradient(ps) do
loss(xhat1, xtrue) # we start with the 30 iteration EM reconstruction
end
opt = ADAMW(0.002)
Flux.Optimise.update!(opt, ps, gs)
end
```
=#

#=
Uncomment to save your trained model:
```
file = "../data/trained-cnn-example-6-dl.bson" # adjust path/name as needed
@save file cnn
```

Load the pre-trained model (uncomment if you save your own model):
```
@load file cnn
```
=#

#=
The code below here works fine when run via `include` from the REPL,
Expand Down
Loading