Skip to content

Commit

Permalink
Set up documentation and improve dim docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
Tokazama committed Feb 1, 2024
1 parent 48a513a commit 4031915
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 8 deletions.
3 changes: 3 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
NIfTI = "a3a9e032-41b5-5fc4-967a-a6b7a19844d3"
20 changes: 20 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using NIfTI
using Documenter

makedocs(;
modules=[NIfTI],
repo="https://github.com/JuliaNeuroscience/NIfTI.jl/blob/{commit}{path}#{line}"
sitename="NIfTI.jl",
format=Documenter.HTML(;
prettyurls=get(ENV, "CI", "false") == "true",
canonical="https://JuliaNeuroscience.github.io/NIfTI.jl",
assets=String[],
),
pages=[
"Home" => "index.md",
],
)

deploydocs(;
repo="github.com/JuliaNeuroscience/NIfTI.jl",
)
11 changes: 11 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

```@meta
CurrentModule = NIfTI
```

# NeuroGraphs

Documentation for [NIfTI](https://github.com/JuliaNeuroscience/NIfTI.jl).

```@docs
```
18 changes: 10 additions & 8 deletions src/headers.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@


function define_packed(ty::DataType)
packed_offsets = cumsum([sizeof(x) for x in ty.types])
sz = pop!(packed_offsets)
Expand Down Expand Up @@ -96,25 +95,28 @@ function byteswap(hdr::NIfTI1Header)
end

"""
freqdim(x)::Int
freqdim(img)::Int
Returns the frequency dimension.
Returns the frequency dimension associated with with `img`. `img` is an image or a collection of
image related metadata.
"""
freqdim(x::NIfTI1Header) = Int(getfield(x, :dim_info) & 0x03)
freqdim(x) = freqdim(header(x))

"""
phasedim(x)::Int
phasedim(img)::Int
Returns the phase dimension.
Returns the phase dimension associated with `img`. `img` is an image or a collection of
image related metadata.
"""
phasedim(x::NIfTI1Header) = Int((getfield(x, :dim_info) >> 2) & 0x03)
phasedim(x) = phasedim(header(x))

"""
slicedim(x)::Int
slicedim(img)::Int
Returns the slice dimension.
Returns the slice dimension associated with `img`. `img` is an image or a collection of
image related metadata.
"""
slicedim(x::NIfTI1Header) = Int((getfield(x, :dim_info) >> 4) & 0x03)
slicedim(x) = slicedim(header(x))
Expand All @@ -138,7 +140,7 @@ slice_end(x) = slice_end(header(x))
"""
slice_duration(x)
Time to acquire one slice
Time to acquire one slice.
"""
slice_duration(x::NIfTI1Header) = getfield(x, :slice_duration)
slice_duration(x) = slice_duration(header(x))
Expand Down

0 comments on commit 4031915

Please sign in to comment.