diff --git a/.documenter-siteinfo.json b/.documenter-siteinfo.json index 920c882..a04cdf6 100644 --- a/.documenter-siteinfo.json +++ b/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.6.7","generation_timestamp":"2024-09-11T17:14:09","documenter_version":"1.7.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.6.7","generation_timestamp":"2024-10-15T03:01:30","documenter_version":"1.7.0"}} \ No newline at end of file diff --git a/function_list/index.html b/function_list/index.html index 0a3ce06..32935f9 100644 --- a/function_list/index.html +++ b/function_list/index.html @@ -1,2 +1,2 @@ -Alphabetical function list · Minc2.jl

Index

+Alphabetical function list · Minc2.jl

Index

diff --git a/geo/index.html b/geo/index.html index 4c5193a..978d250 100644 --- a/geo/index.html +++ b/geo/index.html @@ -1,26 +1,26 @@ -Gemetric transformation functions · Minc2.jl

Functions for gemetric transformations

Base.lengthMethod
Base.length(tr::AnyTransform)

Length of concatenated transform

source
Base.showMethod
Base.show(io::IO, z::GridTransform{T,F,I})

Print summary information about grid transform

source
Base.showMethod
Base.show(io::IO, z::InverseGridTransform{T,F,I})

Print summary information about inverse grid transform

source
Minc2.arrayMethod
array(grid::GridTransform)

Extract underlying plain array

  • grid - GridTransform
source
Minc2.arrayMethod
array(grid::InverseGridTransform)

Extract underlying plain array

  • grid - InverseGridTransform
source
Minc2.decomposeMethod

decompose(rot, shift)

Decompose affine transform specified as rotation matrix ans shift vector into three components start, step, direction cosines

  • rot - rotation matrix (3x3)
  • shift - shift vector (3)
source
Minc2.decomposeMethod
decompose(tfm::Matrix{T})

Decompose affine transform into three components start, step, direction cosines

source
Minc2.decomposeMethod
decompose(tfm::AffineTransform{T})

Decompose affine transform into three components start, step, direction cosines

  • tfm - affine transform
source
Minc2.interpolate_fieldMethod
interpolate_field(
+Gemetric transformation functions · Minc2.jl

Functions for gemetric transformations

Base.lengthMethod
Base.length(tr::AnyTransform)

Length of concatenated transform

source
Base.showMethod
Base.show(io::IO, z::GridTransform{T,F,I})

Print summary information about grid transform

source
Base.showMethod
Base.show(io::IO, z::InverseGridTransform{T,F,I})

Print summary information about inverse grid transform

source
Minc2.arrayMethod
array(grid::GridTransform)

Extract underlying plain array

  • grid - GridTransform
source
Minc2.arrayMethod
array(grid::InverseGridTransform)

Extract underlying plain array

  • grid - InverseGridTransform
source
Minc2.decomposeMethod

decompose(rot, shift)

Decompose affine transform specified as rotation matrix ans shift vector into three components start, step, direction cosines

  • rot - rotation matrix (3x3)
  • shift - shift vector (3)
source
Minc2.decomposeMethod
decompose(tfm::Matrix{T})

Decompose affine transform into three components start, step, direction cosines

source
Minc2.decomposeMethod
decompose(tfm::AffineTransform{T})

Decompose affine transform into three components start, step, direction cosines

  • tfm - affine transform
source
Minc2.interpolate_fieldMethod
interpolate_field(
         v2w::AffineTransform{T},
         itp_vector_field::I, 
-        p::SVector{3,T} )::SVector{3,T}

Internal support function

  • v2w - voxel to world affine transform
  • itp_vector_field - vector field
  • p - point to transform
source
Minc2.invMethod
inv(::IdentityTransform)::IdentityTransform

Invert IdentityTransform transform, does nothing

source
Minc2.invMethod
inv(t::AffineTransform{T})::AffineTransform{T}

Invert AffineTransform transform

  • t - AffineTransform
source
Minc2.invMethod
inv(t::GridTransform{T,F,VF})::InverseGridTransform{T,F,VF}

Invert GridTransform transform

  • t - GridTransform
source
Minc2.invMethod
inv(t::InverseGridTransform{T,F,VF})::GridTransform{T,F,VF}

Invert InverseGridTransform transform

  • t - InverseGridTransform
source
Minc2.invMethod
inv(t::Vector{T})::Vector{AnyTransform}

Invert concatenated transform

  • t - concatenated transform
source
Minc2.transform_pointMethod
transform_point(
+        p::SVector{3,T} )::SVector{3,T}

Internal support function

  • v2w - voxel to world affine transform
  • itp_vector_field - vector field
  • p - point to transform
source
Minc2.invMethod
inv(::IdentityTransform)::IdentityTransform

Invert IdentityTransform transform, does nothing

source
Minc2.invMethod
inv(t::AffineTransform{T})::AffineTransform{T}

Invert AffineTransform transform

  • t - AffineTransform
source
Minc2.invMethod
inv(t::GridTransform{T,F,VF})::InverseGridTransform{T,F,VF}

Invert GridTransform transform

  • t - GridTransform
source
Minc2.invMethod
inv(t::InverseGridTransform{T,F,VF})::GridTransform{T,F,VF}

Invert InverseGridTransform transform

  • t - InverseGridTransform
source
Minc2.invMethod
inv(t::Vector{T})::Vector{AnyTransform}

Invert concatenated transform

  • t - concatenated transform
source
Minc2.transform_pointMethod
transform_point(
         tfm::GridTransform{T,F}, p::SVector{3,T};
-        _whatever...)::SVector{3,T} where {T,F}

Apply forward grid transform to a point

  • tfm - grid transform
  • p - point to transform
source
Minc2.transform_pointMethod
transform_point(
+        _whatever...)::SVector{3,T} where {T,F}

Apply forward grid transform to a point

  • tfm - grid transform
  • p - point to transform
source
Minc2.transform_pointMethod
transform_point(
     tfm::AffineTransform{T}, 
     p::CartesianIndex{3};
-    _whatever...)::SVector{3,T}

Apply inverse grid transform reimplements algorithm from MNIformats/gridtransforms.c:gridinversetransform_point

  • tfm - affine transform
  • p - point to transform
source
Minc2.transform_pointMethod
transform_point(
+    _whatever...)::SVector{3,T}

Apply inverse grid transform reimplements algorithm from MNIformats/gridtransforms.c:gridinversetransform_point

  • tfm - affine transform
  • p - point to transform
source
Minc2.transform_pointMethod
transform_point(
     tfm::AffineTransform{T}, 
     p::CartesianIndex{3};
-    _whatever...)::SVector{3,T}

Apply affine transform to CartesianIndices

  • tfm - affine transform
  • p - point to transform
source
Minc2.transform_pointMethod
transform_point(
+    _whatever...)::SVector{3,T}

Apply affine transform to CartesianIndices

  • tfm - affine transform
  • p - point to transform
source
Minc2.transform_pointMethod
transform_point(
         tfm::AffineTransform{T}, 
         p::SVector{3,T};
-        _whatever...)::SVector{3,T}

Apply affine transform to a point

  • tfm - affine transform
  • p - point to transform
source
Minc2.transform_pointMethod
transform_point(tfm::IdentityTransform, 
+        _whatever...)::SVector{3,T}

Apply affine transform to a point

  • tfm - affine transform
  • p - point to transform
source
Minc2.transform_pointMethod
transform_point(tfm::IdentityTransform, 
     p::SVector{3,T};
-    _whatever...)
  • tfm - IdentityTransform
  • p - point to transform

Apply identity transform to a point (returns same point)

source
Minc2.transform_pointMethod
transform_point(
+    _whatever...)
  • tfm - IdentityTransform
  • p - point to transform

Apply identity transform to a point (returns same point)

source
Minc2.transform_pointMethod
transform_point(
     tfm::Vector{XFM},
     p::SVector{3,T};
     max_iter::Int=10,
-    ftol::Float64=1.0/80)::SVector{3,T}

Apply concatenated transform to a point

  • tfm - concatenated transform
  • p - point to transform
  • max_iter - maximum number of iterations for inverse transform
  • ftol - tolerance for inverse transform
source
Minc2.voxel_to_worldMethod
voxel_to_world(grid::GridTransform)

Extract voxel to world affine transform from a GridTransform

  • grid - GridTransform
source
Minc2.voxel_to_worldMethod
voxel_to_world(grid::InverseGridTransform)

Extract voxel to world affine transform from a InverseGridTransform

  • grid - InverseGridTransform
source
Minc2.world_to_voxelMethod
world_to_voxel(grid::GridTransform)

Extract world to voxel affine transform from a GridTransform

  • grid - GridTransform
source
Minc2.world_to_voxelMethod
world_to_voxel(grid::InverseGridTransform)

Extract world to voxel affine transform from a InverseGridTransform

  • grid - InverseGridTransform
source
Minc2.AffineTransformMethod
AffineTransform(rot, shift) Create affine transform from rotation and shift
  • rot - rotation matrix-like (3x3)

  • shift - shift vector-like (3)

source
Minc2.GridTransformMethod
GridTransform(
+    ftol::Float64=1.0/80)::SVector{3,T}

Apply concatenated transform to a point

  • tfm - concatenated transform
  • p - point to transform
  • max_iter - maximum number of iterations for inverse transform
  • ftol - tolerance for inverse transform
source
Minc2.voxel_to_worldMethod
voxel_to_world(grid::GridTransform)

Extract voxel to world affine transform from a GridTransform

  • grid - GridTransform
source
Minc2.voxel_to_worldMethod
voxel_to_world(grid::InverseGridTransform)

Extract voxel to world affine transform from a InverseGridTransform

  • grid - InverseGridTransform
source
Minc2.world_to_voxelMethod
world_to_voxel(grid::GridTransform)

Extract world to voxel affine transform from a GridTransform

  • grid - GridTransform
source
Minc2.world_to_voxelMethod
world_to_voxel(grid::InverseGridTransform)

Extract world to voxel affine transform from a InverseGridTransform

  • grid - InverseGridTransform
source
Minc2.AffineTransformMethod
AffineTransform(rot, shift) Create affine transform from rotation and shift
  • rot - rotation matrix-like (3x3)

  • shift - shift vector-like (3)

source
Minc2.GridTransformMethod
GridTransform(
     voxel_to_world::AffineTransform{T},
-    vector_field::Array{F, 4})

Construct GridTransform from voxel to world transform and a vector field

  • voxel_to_world - voxel to world affine transform
  • vector_field - vector field
source
Minc2.GridTransformMethod
GridTransform(::Type{T}=Float64,::Type{F}=Float64)

Construct empty GridTransform, which should generate identity transform

source
Minc2.InverseGridTransformMethod
InverseGridTransform(
+    vector_field::Array{F, 4})

Construct GridTransform from voxel to world transform and a vector field

  • voxel_to_world - voxel to world affine transform
  • vector_field - vector field
source
Minc2.GridTransformMethod
GridTransform(::Type{T}=Float64,::Type{F}=Float64)

Construct empty GridTransform, which should generate identity transform

source
Minc2.InverseGridTransformMethod
InverseGridTransform(
     voxel_to_world::AffineTransform{T},
-    vector_field::Array{F, 4})

Construct InverseGridTransform from voxel to world transform and a vector field

  • voxel_to_world - voxel to world affine transform
  • vector_field - vector field
source
+ vector_field::Array{F, 4})

Construct InverseGridTransform from voxel to world transform and a vector field

  • voxel_to_world - voxel to world affine transform
  • vector_field - vector field
source
diff --git a/high_level/index.html b/high_level/index.html index 9848d8d..bee6010 100644 --- a/high_level/index.html +++ b/high_level/index.html @@ -1,25 +1,25 @@ -High level functions · Minc2.jl

High level functions for operations on MRI scans

3D Volume information

Minc2.voxel_to_worldFunction
voxel_to_world(grid::GridTransform)

Extract voxel to world affine transform from a GridTransform

  • grid - GridTransform
source
voxel_to_world(grid::InverseGridTransform)

Extract voxel to world affine transform from a InverseGridTransform

  • grid - InverseGridTransform
source
voxel_to_world(hdr::MincHeader)::AffineTransform{Float64}

Give AffineTransform for world to voxel transformation based on header

source
voxel_to_world(h::VolumeHandle,ijk::Vector{Float64})::Vector{Float64}

Convert contignuous 0-based voxel indexes (I,J,K) to world coordinates (X,Y,Z) 0-based

source
voxel_to_world(vol::Volume3D)

Extract voxel to world affine transform from a Volume3D

source
Minc2.world_to_voxelFunction
world_to_voxel(grid::GridTransform)

Extract world to voxel affine transform from a GridTransform

  • grid - GridTransform
source
world_to_voxel(grid::InverseGridTransform)

Extract world to voxel affine transform from a InverseGridTransform

  • grid - InverseGridTransform
source
world_to_voxel(h::VolumeHandle, xyz::Vector{Float64})::Vector{Float64}

Convert world coordinates (X,Y,Z) to contignuous voxel indexes (I,J,K) 0-based

source
world_to_voxel(hdr::MincHeader)::AffineTransform{Float64}

Give AffineTransform for voxel to world transformation

source
world_to_voxel(vol::Volume3D)

Extract world to voxel affine transform from a Volume3D

source
Minc2.arrayFunction
array(grid::GridTransform)

Extract underlying plain array

  • grid - GridTransform
source
array(grid::InverseGridTransform)

Extract underlying plain array

  • grid - InverseGridTransform
source
array(vol::Volume3D)

Extract underlying plain array

source

File IO functions

Loading 3D volumes

Minc2.read_volumeFunction
read_volume(fn::String; store::Type{T}=Float64)::Volume3D{T}

Read Volume3D from minc file

  • fn - filename
  • store - underlying array type
source
Minc2.read_nifti_volumeFunction
read_nifti_volume(fn::AbstractString; store::Type{T}=Float64)::Volume3D{T}

Read Volume3D from .nii or .nii.gz file

source

Saving 3D volumes

Minc2.save_volumeFunction
save_volume(fn::AbstractString, 
+High level functions · Minc2.jl

High level functions for operations on MRI scans

3D Volume information

Minc2.voxel_to_worldFunction
voxel_to_world(grid::GridTransform)

Extract voxel to world affine transform from a GridTransform

  • grid - GridTransform
source
voxel_to_world(grid::InverseGridTransform)

Extract voxel to world affine transform from a InverseGridTransform

  • grid - InverseGridTransform
source
voxel_to_world(hdr::MincHeader)::AffineTransform{Float64}

Give AffineTransform for world to voxel transformation based on header

source
voxel_to_world(h::VolumeHandle,ijk::Vector{Float64})::Vector{Float64}

Convert contignuous 0-based voxel indexes (I,J,K) to world coordinates (X,Y,Z) 0-based

source
voxel_to_world(vol::Volume3D)

Extract voxel to world affine transform from a Volume3D

source
Minc2.world_to_voxelFunction
world_to_voxel(grid::GridTransform)

Extract world to voxel affine transform from a GridTransform

  • grid - GridTransform
source
world_to_voxel(grid::InverseGridTransform)

Extract world to voxel affine transform from a InverseGridTransform

  • grid - InverseGridTransform
source
world_to_voxel(h::VolumeHandle, xyz::Vector{Float64})::Vector{Float64}

Convert world coordinates (X,Y,Z) to contignuous voxel indexes (I,J,K) 0-based

source
world_to_voxel(hdr::MincHeader)::AffineTransform{Float64}

Give AffineTransform for voxel to world transformation

source
world_to_voxel(vol::Volume3D)

Extract world to voxel affine transform from a Volume3D

source
Minc2.arrayFunction
array(grid::GridTransform)

Extract underlying plain array

  • grid - GridTransform
source
array(grid::InverseGridTransform)

Extract underlying plain array

  • grid - InverseGridTransform
source
array(vol::Volume3D)

Extract underlying plain array

source

File IO functions

Loading 3D volumes

Minc2.read_volumeFunction
read_volume(fn::String; store::Type{T}=Float64)::Volume3D{T}

Read Volume3D from minc file

  • fn - filename
  • store - underlying array type
source
Minc2.read_nifti_volumeFunction
read_nifti_volume(fn::AbstractString; store::Type{T}=Float64)::Volume3D{T}

Read Volume3D from .nii or .nii.gz file

source

Saving 3D volumes

Minc2.save_volumeFunction
save_volume(fn::AbstractString, 
     vol::Volume3D{T,N}; 
     store::Type{S}=Float32,
-    history=nothing)

Save Volume3D to minc file

  • fn - filename
  • vol - Volume3D to save
  • store - underlying MINC data type, to be used for storage
source
Minc2.save_nifti_volumeFunction
save_nifti_volume(fn::AbstractString, vol::Volume3D{T}; 
-    store::Type{S}=Float32, history=nothing)

Save Volume3D into .nii or .nii.gz file

source

Loading transformations

Minc2.read_itk_nifti_transformFunction
read_itk_nifti_transform(fn::AbstractString;
-    store::Type{T}=Float32)::Minc2.GridTransform{Float64,T}

Read ANTs style warp transform

source
Minc2.read_ants_transformFunction
read_ants_transform(fn::AbstractString; store::Type{T}=Float32)::Minc2.AnyTransform

Read .txt and .nii(.nii.gz) transforms produces by ANTs

source

Saving transformations

Minc2.save_transformsFunction
save_transforms(fname::String, 
+    history=nothing)

Save Volume3D to minc file

  • fn - filename
  • vol - Volume3D to save
  • store - underlying MINC data type, to be used for storage
source
Minc2.save_nifti_volumeFunction
save_nifti_volume(fn::AbstractString, vol::Volume3D{T}; 
+    store::Type{S}=Float32, history=nothing)

Save Volume3D into .nii or .nii.gz file

source

Loading transformations

Minc2.read_itk_nifti_transformFunction
read_itk_nifti_transform(fn::AbstractString;
+    store::Type{T}=Float32)::Minc2.GridTransform{Float64,T}

Read ANTs style warp transform

source
Minc2.read_ants_transformFunction
read_ants_transform(fn::AbstractString; store::Type{T}=Float32)::Minc2.AnyTransform

Read .txt and .nii(.nii.gz) transforms produces by ANTs

source

Saving transformations

Minc2.save_transformsFunction
save_transforms(fname::String, 
     xfm::Union{Vector{XFM}, XFM};
-    grid_store::Type{T}=Float32 ) where {T, XFM<:AnyTransform}

Save transformations into .xfm file,

Arguments

  • fname: output file name
  • xfm: vector of transformations to save, or a single transformation
  • grid_store: type of storage for grid files (default: Float32)
source
Minc2.save_itk_nifti_transformFunction
save_itk_nifti_transform(fn::AbstractString,
-    xfm::Minc2.GridTransform{Float64,T}; store::Type{S}=Float32)

Write ANTs style warp transform

source

3D Volume creation

Minc2.Volume3DType
Volume3D{T,N}

An abstract 3D volume, could be vector field or volume with time dimension

source
Minc2.empty_volume_likeFunction
empty_volume_like(
+    grid_store::Type{T}=Float32 ) where {T, XFM<:AnyTransform}

Save transformations into .xfm file,

Arguments

  • fname: output file name
  • xfm: vector of transformations to save, or a single transformation
  • grid_store: type of storage for grid files (default: Float32)
source
Minc2.save_itk_nifti_transformFunction
save_itk_nifti_transform(fn::AbstractString,
+    xfm::Minc2.GridTransform{Float64,T}; store::Type{S}=Float32)

Write ANTs style warp transform

source

3D Volume creation

Minc2.Volume3DType
Volume3D{T,N}

An abstract 3D volume, could be vector field or volume with time dimension

source
Minc2.empty_volume_likeFunction
empty_volume_like(
         fn::String; 
-        store::Type{T}=Float64, history=nothing)::Volume3D{T}

Create an empty Volume3D

  • fn - filename of a minc file that is used for sampling information
  • store - underlying array type
source
empty_volume_like(
+        store::Type{T}=Float64, history=nothing)::Volume3D{T}

Create an empty Volume3D

  • fn - filename of a minc file that is used for sampling information
  • store - underlying array type
source
empty_volume_like(
     vol::Volume3D{T1,N}; 
     store::Type{T}=Float64, 
-    history=nothing)

Create an empty Volume3D

  • vol - Volume3D that is used for sampling information
  • store - underlying array type
  • history - minc history
source
Minc2.full_volume_likeFunction
full_volume_like(
+    history=nothing)

Create an empty Volume3D

  • vol - Volume3D that is used for sampling information
  • store - underlying array type
  • history - minc history
source
Minc2.full_volume_likeFunction
full_volume_like(
         fn::String,
         fill::T=zero(T); 
-        store::Type{T}=Float64, history=nothing)::Volume3D{T}

Create an empty Volume3D

  • fn - filename of a minc file that is used for sampling information
  • store - underlying array type
source
full_volume_like(
+        store::Type{T}=Float64, history=nothing)::Volume3D{T}

Create an empty Volume3D

  • fn - filename of a minc file that is used for sampling information
  • store - underlying array type
source
full_volume_like(
     vol::Volume3D{T1,N}; 
     store::Type{T}=Float64, 
-    history=nothing)

Create an empty Volume3D

  • vol - Volume3D that is used for sampling information
  • store - underlying array type
  • history - minc history
source

3D Volume manipulations

Minc2.resample_volumeFunction
resample_volume(
+    history=nothing)

Create an empty Volume3D

  • vol - Volume3D that is used for sampling information
  • store - underlying array type
  • history - minc history
source

3D Volume manipulations

Minc2.resample_volumeFunction
resample_volume(
     in_vol::Volume3D{T,3};
     like::Union{Volume3D{O,3},Nothing}=nothing,
     tfm::Union{Vector{XFM},XFM,Nothing}=nothing, 
@@ -28,7 +28,7 @@
     fill=0.0,
     order=1,
     ftol=1.0/80,
-    max_iter=10)::Volume3D

Resample Volume3D using transformation

  • in_vol - input Volume3D
  • like - Volume3D that is used for sampling information
  • itfm - inverse of the transformation to apply (i.e from output to input)
  • tfm - transformation to apply (i.e from output to input) (instead of itfm)
  • interp - interpolation method
  • fill - fill value
  • ftol - tolerance, for inverse transformations
  • max_iter - maximum number of iterations, for inverse transformations

Equivalent to mincresample minc command

source
Minc2.resample_volume!Function
resample_volume!(in_vol::AbstractArray{T,3}, 
+    max_iter=10)::Volume3D

Resample Volume3D using transformation

  • in_vol - input Volume3D
  • like - Volume3D that is used for sampling information
  • itfm - inverse of the transformation to apply (i.e from output to input)
  • tfm - transformation to apply (i.e from output to input) (instead of itfm)
  • interp - interpolation method
  • fill - fill value
  • ftol - tolerance, for inverse transformations
  • max_iter - maximum number of iterations, for inverse transformations

Equivalent to mincresample minc command

source
Minc2.resample_volume!Function
resample_volume!(in_vol::AbstractArray{T,3}, 
     out_vol::AbstractArray{T,3}, 
     v2w::AffineTransform{C}, 
     w2v::AffineTransform{C}, 
@@ -36,7 +36,7 @@
     interp::I=BSpline(Quadratic(Line(OnCell()))),
     fill=0.0,
     ftol=1.0/80,
-    max_iter=10)

Resample 3D array using transformation

  • in_vol - input 3D array
  • out_vol - output 3D array
  • v2w - voxel to world affine transform in the output array
  • w2v - world to voxel affine transform in the input array
  • itfm - inverse of the transformation to apply (i.e from output to input)
  • interp - interpolation method
  • fill - fill value
  • ftol - tolerance, for inverse transformations
  • max_iter - maximum number of iterations, for inverse transformations
source
resample_volume!(
+    max_iter=10)

Resample 3D array using transformation

  • in_vol - input 3D array
  • out_vol - output 3D array
  • v2w - voxel to world affine transform in the output array
  • w2v - world to voxel affine transform in the input array
  • itfm - inverse of the transformation to apply (i.e from output to input)
  • interp - interpolation method
  • fill - fill value
  • ftol - tolerance, for inverse transformations
  • max_iter - maximum number of iterations, for inverse transformations
source
resample_volume!(
     in_vol::Volume3D{T,3}, 
     out_vol::Volume3D{O,3}; 
     tfm::Union{Vector{XFM},XFM,Nothing}=nothing, 
@@ -45,34 +45,34 @@
     fill=0.0, 
     order=nothing,
     ftol=1.0/80,
-    max_iter=10)::Volume3D{O,3}

Resample Volume3D using transformation

  • in_vol - input Volume3D
  • out_vol - output Volume3D
  • itfm - inverse of the transformation to apply (i.e from output to input)
  • tfm - transformation to apply (i.e from output to input) (instead of itfm)
  • interp - interpolation method
  • fill - fill value
  • ftol - tolerance, for inverse transformations
  • max_iter - maximum number of iterations, for inverse transformations

Equivalent to mincresample minc command

source
Minc2.resample_gridFunction
resample_grid(
+    max_iter=10)::Volume3D{O,3}

Resample Volume3D using transformation

  • in_vol - input Volume3D
  • out_vol - output Volume3D
  • itfm - inverse of the transformation to apply (i.e from output to input)
  • tfm - transformation to apply (i.e from output to input) (instead of itfm)
  • interp - interpolation method
  • fill - fill value
  • ftol - tolerance, for inverse transformations
  • max_iter - maximum number of iterations, for inverse transformations

Equivalent to mincresample minc command

source
Minc2.resample_gridFunction
resample_grid(
     in_grid::Volume3D{T,4}, 
     itfm::Union{Vector{XFM}, XFM}; 
-    like::Union{Nothing,Volume3D{L,4}}=nothing)::Volume3D{T,4}

Resample Volume3D that contain 4D array, using transformation, assume 1st dimension is non spatial

  • in_grid - input Volume3D with 4D array describing vector field
  • itfm - inverse of the transformation to apply (i.e from output to input)
  • like - Volume3D that is used for sampling information
source
Minc2.resample_grid!Function
resample_grid!(
+    like::Union{Nothing,Volume3D{L,4}}=nothing)::Volume3D{T,4}

Resample Volume3D that contain 4D array, using transformation, assume 1st dimension is non spatial

  • in_grid - input Volume3D with 4D array describing vector field
  • itfm - inverse of the transformation to apply (i.e from output to input)
  • like - Volume3D that is used for sampling information
source
Minc2.resample_grid!Function
resample_grid!(
     in_grid::Volume3D{T,4},
     out_grid::Volume3D{T,4},
-    itfm::Union{Vector{XFM}, XFM}=nothing)::Volume3D{T,4}

Resample Volume3D that contain 4D array, using transformation, assume 1st dimension is non spatial

  • in_grid - input Volume3D with 4D array describing vector field
  • out_grid - output Volume3D with 4D array describing vector field
  • itfm - inverse of the transformation to apply (i.e from output to input)
source
Minc2.crop_volumeFunction
crop_volume(in_vol::Volume3D{T,N},crop;
-    fill_val::T=zero(T))::Volume3D{T,N}

Crop (or pad) a volume

  • in_vol - input Volume3D
  • crop - crop specification for each direction, e.g. [(10,10),(20,20),(5,10)] , negative values mean padding
source
Minc2.calculate_jacobianFunction
calculate_jacobian(
+    itfm::Union{Vector{XFM}, XFM}=nothing)::Volume3D{T,4}

Resample Volume3D that contain 4D array, using transformation, assume 1st dimension is non spatial

  • in_grid - input Volume3D with 4D array describing vector field
  • out_grid - output Volume3D with 4D array describing vector field
  • itfm - inverse of the transformation to apply (i.e from output to input)
source
Minc2.crop_volumeFunction
crop_volume(in_vol::Volume3D{T,N},crop;
+    fill_val::T=zero(T))::Volume3D{T,N}

Crop (or pad) a volume

  • in_vol - input Volume3D
  • crop - crop specification for each direction, e.g. [(10,10),(20,20),(5,10)] , negative values mean padding
source
Minc2.calculate_jacobianFunction
calculate_jacobian(
     tfm::Union{Vector{XFM},XFM};
     like::Volume3D{T,3}; 
     interp::I=BSpline(Quadratic(Line(OnCell()))),
     ftol=1.0/80,
-    max_iter=10)::Volume3D{T,3}

Calculate dense jacobian determinant field for an arbitrary transformation

  • tfm - transformation to use
  • out_vol - output Volume3D
  • interp - interpolation method
  • ftol - tolerance, for inverse transformations
  • max_iter - maximum number of iterations, for inverse transformations

Roughly equivalent to mincblob minc command

source
Minc2.calculate_jacobian!Function
calculate_jacobian!(
+    max_iter=10)::Volume3D{T,3}

Calculate dense jacobian determinant field for an arbitrary transformation

  • tfm - transformation to use
  • out_vol - output Volume3D
  • interp - interpolation method
  • ftol - tolerance, for inverse transformations
  • max_iter - maximum number of iterations, for inverse transformations

Roughly equivalent to mincblob minc command

source
Minc2.calculate_jacobian!Function
calculate_jacobian!(
     tfm::Union{Vector{XFM},XFM},
     out_vol::AbstractArray{T,3},
     out_v2w::AffineTransform{C};
     interp::I=BSpline(Quadratic(Line(OnCell()))),
     ftol=1.0/80,
-    max_iter=10)

Calculate dense jacobian determinant field for an arbitrary transformation

  • tfm - transformation to use
  • out_vol - output 3D array
  • out_v2w - voxel to world affine transform in the output array
  • interp - interpolation method
  • ftol - tolerance, for inverse transformations
  • max_iter - maximum number of iterations, for inverse transformations

Roughly equivalent to mincblob minc command

source
calculate_jacobian!(
+    max_iter=10)

Calculate dense jacobian determinant field for an arbitrary transformation

  • tfm - transformation to use
  • out_vol - output 3D array
  • out_v2w - voxel to world affine transform in the output array
  • interp - interpolation method
  • ftol - tolerance, for inverse transformations
  • max_iter - maximum number of iterations, for inverse transformations

Roughly equivalent to mincblob minc command

source
calculate_jacobian!(
     tfm::Union{Vector{XFM},XFM}, 
     out_vol::Volume3D{T,3}; 
     interp::I=BSpline(Quadratic(Line(OnCell()))),
     ftol=1.0/80,
-    max_iter=10)::Volume3D{T,3}

Calculate dense jacobian determinant field for an arbitrary transformation

  • tfm - transformation to use
  • out_vol - output Volume3D
  • interp - interpolation method
  • ftol - tolerance, for inverse transformations
  • max_iter - maximum number of iterations, for inverse transformations

Roughly equivalent to mincblob minc command

source
Missing docstring.

Missing docstring for Minc2.GridTransform. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Minc2.InverseGridTransform. Check Documenter's build log for details.

Minc2.tfm_to_gridFunction
tfm_to_grid(
+    max_iter=10)::Volume3D{T,3}

Calculate dense jacobian determinant field for an arbitrary transformation

  • tfm - transformation to use
  • out_vol - output Volume3D
  • interp - interpolation method
  • ftol - tolerance, for inverse transformations
  • max_iter - maximum number of iterations, for inverse transformations

Roughly equivalent to mincblob minc command

source
Missing docstring.

Missing docstring for Minc2.GridTransform. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Minc2.InverseGridTransform. Check Documenter's build log for details.

Minc2.tfm_to_gridFunction
tfm_to_grid(
     tfm::Union{Vector{XFM}, XFM},
     ref::G;
-    store::Type{T}=Float64,ftol=1.0/80,max_iter=10)::Volume3D{T,4}

Convert arbitrary transformation into Volume3D with 4D array containing vector field

  • tfm - transformation to use
  • v2w - voxel to world affine transform in the output array
  • ftol - tolerance, for inverse transformations
  • max_iter - maximum number of iterations, for inverse transformations
source
Minc2.normalize_tfmFunction
normalize_tfm(tfm::Union{Vector{XFM}, XFM},
+    store::Type{T}=Float64,ftol=1.0/80,max_iter=10)::Volume3D{T,4}

Convert arbitrary transformation into Volume3D with 4D array containing vector field

  • tfm - transformation to use
  • v2w - voxel to world affine transform in the output array
  • ftol - tolerance, for inverse transformations
  • max_iter - maximum number of iterations, for inverse transformations
source
Minc2.normalize_tfmFunction
normalize_tfm(tfm::Union{Vector{XFM}, XFM},
     ref::G;
-    store::Type{T}=Float64,ftol=1.0/80,max_iter=10)::GridTransform{Float64,T}

Convert arbitrary transformation into a single GridTransform

  • tfm - transformation to use
  • ref - GridTransform that is used for sampling information
  • store - underlying array type
  • ftol - tolerance, for inverse transformations
  • max_iter - maximum number of iterations, for inverse transformations
source
normalize_tfm(tfm::Union{Vector{XFM}, XFM},
+    store::Type{T}=Float64,ftol=1.0/80,max_iter=10)::GridTransform{Float64,T}

Convert arbitrary transformation into a single GridTransform

  • tfm - transformation to use
  • ref - GridTransform that is used for sampling information
  • store - underlying array type
  • ftol - tolerance, for inverse transformations
  • max_iter - maximum number of iterations, for inverse transformations
source
normalize_tfm(tfm::Union{Vector{XFM}, XFM},
     ref::G;
-    store::Type{T}=Float64,ftol=1.0/80,max_iter=10)::GridTransform{Float64,T}

Convert arbitrary transformation into a single GridTransform

  • tfm - transformation to use
  • ref - Volume3D that is used for sampling information
  • store - underlying array type
  • ftol - tolerance, for inverse transformations
  • max_iter - maximum number of iterations, for inverse transformations
source
+ store::Type{T}=Float64,ftol=1.0/80,max_iter=10)::GridTransform{Float64,T}

Convert arbitrary transformation into a single GridTransform

  • tfm - transformation to use
  • ref - Volume3D that is used for sampling information
  • store - underlying array type
  • ftol - tolerance, for inverse transformations
  • max_iter - maximum number of iterations, for inverse transformations
source
diff --git a/index.html b/index.html index 485d663..4b96984 100644 --- a/index.html +++ b/index.html @@ -91,4 +91,4 @@ resize_to_layout!(fig) -save("mni_icbm152_gm.png", fig, px_per_unit = 1)

Will produce MNI-ICBM152

More examples

See examples directory for more examples:

Documentation for MINC

Documentations for underlying libminc and minc tools is available at https://en.wikibooks.org/wiki/MINC

+save("mni_icbm152_gm.png", fig, px_per_unit = 1)

Will produce MNI-ICBM152

More examples

See examples directory for more examples:

Documentation for MINC

Documentations for underlying libminc and minc tools is available at https://en.wikibooks.org/wiki/MINC

diff --git a/low_level/index.html b/low_level/index.html index cc4968e..6fe3fe6 100644 --- a/low_level/index.html +++ b/low_level/index.html @@ -1,25 +1,25 @@ -Low level functions · Minc2.jl

Low level functions for IO on .mnc and .xfm files

Minc2.attributesMethod
attributes(h::VolumeHandle, g::String)

List attributes defined inside given group

source
Minc2.create_header_from_v2wMethod
create_header_from_v2w(
+Low level functions · Minc2.jl

Low level functions for IO on .mnc and .xfm files

Minc2.attributesMethod
attributes(h::VolumeHandle, g::String)

List attributes defined inside given group

source
Minc2.create_header_from_v2wMethod
create_header_from_v2w(
     sz, t::AffineTransform{T};
     vector_dim::Bool=false, 
     time_step::Union{Float64,Nothing}=nothing,
-    time_start::Union{Float64,Nothing}=nothing)::MincHeader

Internal: Generate header from the voxel to world transform and volume size

source
Minc2.create_minc_fileMethod
create_minc_file(h::VolumeHandle, path::AbstractString)

Create empty minc file on disk, structure need to be defined in advance

source
Minc2.define_minc_fileMethod
define_minc_file(hdr::MincHeader,::Type{Store}=Float32,::Type{Repr}=Store)

Define new minc file structure, return handle

source
Minc2.empty_like_minc_volume_rawMethod
empty_like_minc_volume_raw( h::VolumeHandle,
-    ::Type{T}=Float32 )::Tuple{Array{T}, Minc2.MincHeader}

Allocate empty volume using handle return volume, storage header

source
Minc2.empty_like_minc_volume_rawMethod
empty_like_minc_volume_raw(path::String, ::Type{T}=Float32 )::
-        Tuple{Array{T}, Minc2.MincHeader}

Create empty volume similar to existing file return volume, representation header,storage header

source
Minc2.empty_like_minc_volume_stdMethod
empty_like_minc_volume_std(h::VolumeHandle, 
-    ::Type{T}=Float32 )::Tuple{Array{T}, Minc2.MincHeader, Minc2.MincHeader}

Read the actual volume using handle return volume, representation header,storage header

source
Minc2.empty_like_minc_volume_stdMethod
empty_like_minc_volume_std(path::String, 
-    ::Type{T}=Float32 )::Tuple{Array{T}, Minc2.MincHeader, Minc2.MincHeader}

allocate empty volume using path as a reference return volume, representation header,storage header

source
Minc2.get_attributeMethod
get_attribute(h::VolumeHandle,g::String,a::String; default=missing)

Convenience function for reading specific attribute, return default value if not found also convert Array into the first value if it's a one-length array

source
Minc2.ndimMethod
ndim(h::VolumeHandle)::Int

Query number of dimensions in the minc file

source
Minc2.read_attributeMethod
read_attribute(h::VolumeHandle, 
+    time_start::Union{Float64,Nothing}=nothing)::MincHeader

Internal: Generate header from the voxel to world transform and volume size

source
Minc2.create_minc_fileMethod
create_minc_file(h::VolumeHandle, path::AbstractString)

Create empty minc file on disk, structure need to be defined in advance

source
Minc2.define_minc_fileMethod
define_minc_file(hdr::MincHeader,::Type{Store}=Float32,::Type{Repr}=Store)

Define new minc file structure, return handle

source
Minc2.empty_like_minc_volume_rawMethod
empty_like_minc_volume_raw( h::VolumeHandle,
+    ::Type{T}=Float32 )::Tuple{Array{T}, Minc2.MincHeader}

Allocate empty volume using handle return volume, storage header

source
Minc2.empty_like_minc_volume_rawMethod
empty_like_minc_volume_raw(path::String, ::Type{T}=Float32 )::
+        Tuple{Array{T}, Minc2.MincHeader}

Create empty volume similar to existing file return volume, representation header,storage header

source
Minc2.empty_like_minc_volume_stdMethod
empty_like_minc_volume_std(h::VolumeHandle, 
+    ::Type{T}=Float32 )::Tuple{Array{T}, Minc2.MincHeader, Minc2.MincHeader}

Read the actual volume using handle return volume, representation header,storage header

source
Minc2.empty_like_minc_volume_stdMethod
empty_like_minc_volume_std(path::String, 
+    ::Type{T}=Float32 )::Tuple{Array{T}, Minc2.MincHeader, Minc2.MincHeader}

allocate empty volume using path as a reference return volume, representation header,storage header

source
Minc2.get_attributeMethod
get_attribute(h::VolumeHandle,g::String,a::String; default=missing)

Convenience function for reading specific attribute, return default value if not found also convert Array into the first value if it's a one-length array

source
Minc2.ndimMethod
ndim(h::VolumeHandle)::Int

Query number of dimensions in the minc file

source
Minc2.read_attributeMethod
read_attribute(h::VolumeHandle, 
     group::String,
-    attribute::String)::Union{String, AbstractVector, Nothing}

Read minc2 header attribute :param group: attribute group name :param attribute: attribute name :return:

source
Minc2.read_minc_volume_rawMethod
read_minc_volume_raw(h::VolumeHandle, 
-    ::Type{T}=Float32 )::Tuple{Array{T}, Minc2.MincHeader}

Read the actual volume using handle return volume, storage header

source
Minc2.read_minc_volume_rawMethod
read_minc_volume_raw(path::String, ::Type{T}=Float32 )::
-    Tuple{Array{T}, Minc2.MincHeader}

Read the actual volume using path return volume, representation header,storage header

source
Minc2.read_minc_volume_stdMethod
read_minc_volume_std(h::VolumeHandle, 
-    ::Type{T}=Float32 )::Tuple{Array{T}, Minc2.MincHeader, Minc2.MincHeader}

Read the actual volume using handle return volume, representation header,storage header

source
Minc2.read_minc_volume_stdMethod
read_minc_volume_std(path::String, ::Type{T}=Float32 )::
-    Tuple{Array{T}, Minc2.MincHeader, Minc2.MincHeader}

Read the actual volume using path return volume, representation header,storage header

source
Minc2.read_minc_volume_std_historyMethod
read_minc_volume_std_history(path::String, ::Type{T}=Float32 )::
-    Tuple{Array{T}, Minc2.MincHeader, Minc2.MincHeader, Union{String,Nothing}}

Read the actual volume using path return volume, representation header,storage header

source
Minc2.representation_typeMethod
store_type(h::VolumeHandle)::Type

Query representation data type of the minc file, WARNING: it doesn't nacessery mean that it's the same as store_type type

source
Minc2.store_typeMethod
store_type(h::VolumeHandle)::Type

Query storage data type of the minc file, WARNING: it doesn't nacessery mean that it's the same as representation type

source
Minc2.voxel_to_worldMethod
voxel_to_world(hdr::MincHeader)::AffineTransform{Float64}

Give AffineTransform for world to voxel transformation based on header

source
Minc2.voxel_to_worldMethod
voxel_to_world(h::VolumeHandle,ijk::Vector{Float64})::Vector{Float64}

Convert contignuous 0-based voxel indexes (I,J,K) to world coordinates (X,Y,Z) 0-based

source
Minc2.world_to_voxelMethod
world_to_voxel(hdr::MincHeader)::AffineTransform{Float64}

Give AffineTransform for voxel to world transformation

source
Minc2.world_to_voxelMethod
world_to_voxel(h::VolumeHandle, xyz::Vector{Float64})::Vector{Float64}

Convert world coordinates (X,Y,Z) to contignuous voxel indexes (I,J,K) 0-based

source
Minc2.write_attributeMethod
write_attribute(h::VolumeHandle, group::String, attribute::String, value::T)

Store attribute into minc2 file :param group: group name :param attribute: attribute name :param value: attribute value :return:

source
Minc2.write_minc_volume_rawMethod
write_minc_volume_raw(path::String, ::Type{Store}, 
+    attribute::String)::Union{String, AbstractVector, Nothing}

Read minc2 header attribute :param group: attribute group name :param attribute: attribute name :return:

source
Minc2.read_minc_volume_rawMethod
read_minc_volume_raw(h::VolumeHandle, 
+    ::Type{T}=Float32 )::Tuple{Array{T}, Minc2.MincHeader}

Read the actual volume using handle return volume, storage header

source
Minc2.read_minc_volume_rawMethod
read_minc_volume_raw(path::String, ::Type{T}=Float32 )::
+    Tuple{Array{T}, Minc2.MincHeader}

Read the actual volume using path return volume, representation header,storage header

source
Minc2.read_minc_volume_stdMethod
read_minc_volume_std(h::VolumeHandle, 
+    ::Type{T}=Float32 )::Tuple{Array{T}, Minc2.MincHeader, Minc2.MincHeader}

Read the actual volume using handle return volume, representation header,storage header

source
Minc2.read_minc_volume_stdMethod
read_minc_volume_std(path::String, ::Type{T}=Float32 )::
+    Tuple{Array{T}, Minc2.MincHeader, Minc2.MincHeader}

Read the actual volume using path return volume, representation header,storage header

source
Minc2.read_minc_volume_std_historyMethod
read_minc_volume_std_history(path::String, ::Type{T}=Float32 )::
+    Tuple{Array{T}, Minc2.MincHeader, Minc2.MincHeader, Union{String,Nothing}}

Read the actual volume using path return volume, representation header,storage header

source
Minc2.representation_typeMethod
store_type(h::VolumeHandle)::Type

Query representation data type of the minc file, WARNING: it doesn't nacessery mean that it's the same as store_type type

source
Minc2.store_typeMethod
store_type(h::VolumeHandle)::Type

Query storage data type of the minc file, WARNING: it doesn't nacessery mean that it's the same as representation type

source
Minc2.voxel_to_worldMethod
voxel_to_world(hdr::MincHeader)::AffineTransform{Float64}

Give AffineTransform for world to voxel transformation based on header

source
Minc2.voxel_to_worldMethod
voxel_to_world(h::VolumeHandle,ijk::Vector{Float64})::Vector{Float64}

Convert contignuous 0-based voxel indexes (I,J,K) to world coordinates (X,Y,Z) 0-based

source
Minc2.world_to_voxelMethod
world_to_voxel(hdr::MincHeader)::AffineTransform{Float64}

Give AffineTransform for voxel to world transformation

source
Minc2.world_to_voxelMethod
world_to_voxel(h::VolumeHandle, xyz::Vector{Float64})::Vector{Float64}

Convert world coordinates (X,Y,Z) to contignuous voxel indexes (I,J,K) 0-based

source
Minc2.write_attributeMethod
write_attribute(h::VolumeHandle, group::String, attribute::String, value::T)

Store attribute into minc2 file :param group: group name :param attribute: attribute name :param value: attribute value :return:

source
Minc2.write_minc_volume_rawMethod
write_minc_volume_raw(path::String, ::Type{Store}, 
     store_hdr::Union{MincHeader, Nothing}, 
     volume::Array{Repr};like::Union{String, Nothing}=nothing, 
-    history::Union{String, Nothing}=nothing )

Write full volume to file, need to provide details of file structure return nothing

source
Minc2.write_minc_volume_rawMethod
write_minc_volume_raw(h::VolumeHandle, volume::Array{T} )

write full volume to file, file should be defined and created return nothing

source
Minc2.write_minc_volume_stdMethod
write_minc_volume_std(path::String, ::Type{Store}, 
+    history::Union{String, Nothing}=nothing )

Write full volume to file, need to provide details of file structure return nothing

source
Minc2.write_minc_volume_rawMethod
write_minc_volume_raw(h::VolumeHandle, volume::Array{T} )

write full volume to file, file should be defined and created return nothing

source
Minc2.write_minc_volume_stdMethod
write_minc_volume_std(path::String, ::Type{Store}, 
     store_hdr::Union{MincHeader, Nothing}, 
     volume::Array{Repr};like::Union{String, Nothing}=nothing, 
-    history::Union{String, Nothing}=nothing )

Write full volume to file, need to provide details of file structure return nothing

source
Minc2.write_minc_volume_stdMethod
write_minc_volume_std(h::VolumeHandle, volume::Array{T} )

write full volume to file, file should be defined and created return nothing

source
Minc2.MincHeaderType
MincHeader

Structure describing spatial orientation and sampling of the minc file

source
Minc2.minc2_spatialConstant

Low Level: Mapping MINC2 spatial dimensions to proper spatial dimension (should be identity for spatial dims)

source
Minc2.append_grid_transformMethod
append_grid_transform(h::TransformHandle, grid_file::String; inv::Bool=false)

Low level: Append grid transform to an open transformation handle

source
Minc2.append_linear_transformMethod
append_linear_transform(h::TransformHandle, lin::AffineTransform)

Low level: Append affine transform to an open transformation handle

source
Minc2.concat_xfmMethod
concat_xfm(h::TransformHandle, i::TransformHandle)

Low level: concatenate two transfomations

source
Minc2.get_grid_transformMethod
get_grid_transform(h::TransformHandle; n::Int64=0)

Low level: extract reference to a grid file from open handle

source
Minc2.get_linear_transformMethod
get_linear_transform(h::TransformHandle; n::Int64=0)::AffineTransform{Float64}

Low level: extract AffineTransform{Float64} from open handle

source
Minc2.get_linear_transform_paramMethod
get_linear_transform_param(h::TransformHandle;n::Int64=0,center::Union{Nothing,Vector{Float64}}=nothing)

Low level: extact transformation parameters from affine transform , returns named tuple with fields center, translations, scales, shears, rotations

source
Minc2.get_n_concatMethod
get_n_concat(h::TransformHandle)::Int64

Low level: Get number of transformations in open handle

source
Minc2.get_n_typeMethod
get_n_type(h::TransformHandle; n::Int64=0)::XFM

Low level: Get transform type for nth transform in open handle

source
Minc2.inverse_transform_pointMethod
inverse_transform_point(h::TransformHandle, xyz::Vector{Float64})::Vector{Float64}

Low level: Inverse transform point xyz using minc transform h

source
Minc2.load_transformsMethod
load_transforms(h::TransformHandle)::Vector{AnyTransform}

Low level: Load all transforms from open .XFM handle

source
Minc2.save_transformsMethod
save_transforms(fname::String, 
+    history::Union{String, Nothing}=nothing )

Write full volume to file, need to provide details of file structure return nothing

source
Minc2.write_minc_volume_stdMethod
write_minc_volume_std(h::VolumeHandle, volume::Array{T} )

write full volume to file, file should be defined and created return nothing

source
Minc2.MincHeaderType
MincHeader

Structure describing spatial orientation and sampling of the minc file

source
Minc2.minc2_spatialConstant

Low Level: Mapping MINC2 spatial dimensions to proper spatial dimension (should be identity for spatial dims)

source
Minc2.append_grid_transformMethod
append_grid_transform(h::TransformHandle, grid_file::String; inv::Bool=false)

Low level: Append grid transform to an open transformation handle

source
Minc2.append_linear_transformMethod
append_linear_transform(h::TransformHandle, lin::AffineTransform)

Low level: Append affine transform to an open transformation handle

source
Minc2.concat_xfmMethod
concat_xfm(h::TransformHandle, i::TransformHandle)

Low level: concatenate two transfomations

source
Minc2.get_grid_transformMethod
get_grid_transform(h::TransformHandle; n::Int64=0)

Low level: extract reference to a grid file from open handle

source
Minc2.get_linear_transformMethod
get_linear_transform(h::TransformHandle; n::Int64=0)::AffineTransform{Float64}

Low level: extract AffineTransform{Float64} from open handle

source
Minc2.get_linear_transform_paramMethod
get_linear_transform_param(h::TransformHandle;n::Int64=0,center::Union{Nothing,Vector{Float64}}=nothing)

Low level: extact transformation parameters from affine transform , returns named tuple with fields center, translations, scales, shears, rotations

source
Minc2.get_n_concatMethod
get_n_concat(h::TransformHandle)::Int64

Low level: Get number of transformations in open handle

source
Minc2.get_n_typeMethod
get_n_type(h::TransformHandle; n::Int64=0)::XFM

Low level: Get transform type for nth transform in open handle

source
Minc2.inverse_transform_pointMethod
inverse_transform_point(h::TransformHandle, xyz::Vector{Float64})::Vector{Float64}

Low level: Inverse transform point xyz using minc transform h

source
Minc2.load_transformsMethod
load_transforms(h::TransformHandle)::Vector{AnyTransform}

Low level: Load all transforms from open .XFM handle

source
Minc2.save_transformsMethod
save_transforms(fname::String, 
     xfm::Union{Vector{XFM}, XFM};
-    grid_store::Type{T}=Float32 ) where {T, XFM<:AnyTransform}

Save transformations into .xfm file,

Arguments

  • fname: output file name
  • xfm: vector of transformations to save, or a single transformation
  • grid_store: type of storage for grid files (default: Float32)
source
Minc2.save_xfm_fileMethod
save_xfm_file(h::TransformHandle, path::String)

Low level: Save information into file from an open handle

source
Minc2.transform_pointMethod
transform_point(h::TransformHandle, xyz::Vector{Float64})::Vector{Float64}

Low level: Transform point xyz using minc transform h

source
Minc2.XFMType

@enum XFM

Low level: transformation types stored in .xfm file

source
+ grid_store::Type{T}=Float32 ) where {T, XFM<:AnyTransform}

Save transformations into .xfm file,

Arguments

  • fname: output file name
  • xfm: vector of transformations to save, or a single transformation
  • grid_store: type of storage for grid files (default: Float32)
source
Minc2.save_xfm_fileMethod
save_xfm_file(h::TransformHandle, path::String)

Low level: Save information into file from an open handle

source
Minc2.transform_pointMethod
transform_point(h::TransformHandle, xyz::Vector{Float64})::Vector{Float64}

Low level: Transform point xyz using minc transform h

source
Minc2.XFMType

@enum XFM

Low level: transformation types stored in .xfm file

source
diff --git a/objects.inv b/objects.inv index c1bd4e1..21d122c 100644 Binary files a/objects.inv and b/objects.inv differ diff --git a/plotting/index.html b/plotting/index.html index e64507f..521bd86 100644 --- a/plotting/index.html +++ b/plotting/index.html @@ -25,7 +25,7 @@ cmap = :rainbow, levels = [20,30], show_colorbar = true, - nslices = 4)

Draws a segmentation seg on top of anat in a grid layout layout

source

Show MNI-ICBM152 template contours with GM proability map

using CairoMakie
+    nslices = 4)

Draws a segmentation seg on top of anat in a grid layout layout

source

Show MNI-ICBM152 template contours with GM proability map

using CairoMakie
 using Minc2
 
 # read T1w scan
@@ -50,7 +50,7 @@
     cmap=:rainbow, levels=[20, 40],
     heat_limits=nothing, 
     show_colorbar=true,
-    nslices=4)

Draws a heatmap of heat on top of anat in a grid layout layout.

source

Show two-tailed t-statistics on DBM style analysis

using CairoMakie
+    nslices=4)

Draws a heatmap of heat on top of anat in a grid layout layout.

source

Show two-tailed t-statistics on DBM style analysis

using CairoMakie
 using Minc2
 
 # read T1w scan and crop black area around ROI
@@ -97,4 +97,4 @@
     alpha=0.7,
     colorbar_label="",
     slices_gap=5,
-    colorbar_gap=10)

Draws a two-sided (symmetric positive and negative) heatmap of heat on top of anat in a grid layout layout.

source + colorbar_gap=10)

Draws a two-sided (symmetric positive and negative) heatmap of heat on top of anat in a grid layout layout.

source diff --git a/search_index.js b/search_index.js index c97909f..765e3dd 100644 --- a/search_index.js +++ b/search_index.js @@ -1,3 +1,3 @@ var documenterSearchIndex = {"docs": -[{"location":"function_list/","page":"Alphabetical function list","title":"Alphabetical function list","text":"CurrentModule = Minc2\n\nDocTestSetup = quote\n using Minc2\nend","category":"page"},{"location":"function_list/#Index","page":"Alphabetical function list","title":"Index","text":"","category":"section"},{"location":"function_list/","page":"Alphabetical function list","title":"Alphabetical function list","text":"","category":"page"},{"location":"high_level/","page":"High level functions","title":"High level functions","text":"CurrentModule = Minc2\n\nDocTestSetup = quote\n using Minc2\nend","category":"page"},{"location":"high_level/#High-level-functions-for-operations-on-MRI-scans","page":"High level functions","title":"High level functions for operations on MRI scans","text":"","category":"section"},{"location":"high_level/#3D-Volume-information","page":"High level functions","title":"3D Volume information","text":"","category":"section"},{"location":"high_level/","page":"High level functions","title":"High level functions","text":"Minc2.voxel_to_world\nMinc2.world_to_voxel\nMinc2.array\nMinc2.history\n","category":"page"},{"location":"high_level/#Minc2.voxel_to_world","page":"High level functions","title":"Minc2.voxel_to_world","text":"voxel_to_world(grid::GridTransform)\n\nExtract voxel to world affine transform from a GridTransform\n\ngrid - GridTransform\n\n\n\n\n\nvoxel_to_world(grid::InverseGridTransform)\n\nExtract voxel to world affine transform from a InverseGridTransform\n\ngrid - InverseGridTransform\n\n\n\n\n\nvoxel_to_world(hdr::MincHeader)::AffineTransform{Float64}\n\nGive AffineTransform for world to voxel transformation based on header\n\n\n\n\n\nvoxel_to_world(h::VolumeHandle,ijk::Vector{Float64})::Vector{Float64}\n\nConvert contignuous 0-based voxel indexes (I,J,K) to world coordinates (X,Y,Z) 0-based\n\n\n\n\n\nvoxel_to_world(vol::Volume3D)\n\nExtract voxel to world affine transform from a Volume3D\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.world_to_voxel","page":"High level functions","title":"Minc2.world_to_voxel","text":"world_to_voxel(grid::GridTransform)\n\nExtract world to voxel affine transform from a GridTransform\n\ngrid - GridTransform\n\n\n\n\n\nworld_to_voxel(grid::InverseGridTransform)\n\nExtract world to voxel affine transform from a InverseGridTransform\n\ngrid - InverseGridTransform\n\n\n\n\n\nworld_to_voxel(h::VolumeHandle, xyz::Vector{Float64})::Vector{Float64}\n\nConvert world coordinates (X,Y,Z) to contignuous voxel indexes (I,J,K) 0-based\n\n\n\n\n\nworld_to_voxel(hdr::MincHeader)::AffineTransform{Float64}\n\nGive AffineTransform for voxel to world transformation\n\n\n\n\n\nworld_to_voxel(vol::Volume3D)\n\nExtract world to voxel affine transform from a Volume3D\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.array","page":"High level functions","title":"Minc2.array","text":"array(grid::GridTransform)\n\nExtract underlying plain array\n\ngrid - GridTransform\n\n\n\n\n\narray(grid::InverseGridTransform)\n\nExtract underlying plain array\n\ngrid - InverseGridTransform\n\n\n\n\n\narray(vol::Volume3D)\n\nExtract underlying plain array\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.history","page":"High level functions","title":"Minc2.history","text":"history(vol::Volume3D)\n\nExtract history metadata\n\n\n\n\n\n","category":"function"},{"location":"high_level/#File-IO-functions","page":"High level functions","title":"File IO functions","text":"","category":"section"},{"location":"high_level/#Loading-3D-volumes","page":"High level functions","title":"Loading 3D volumes","text":"","category":"section"},{"location":"high_level/","page":"High level functions","title":"High level functions","text":"Minc2.read_volume\nMinc2.read_nifti_volume","category":"page"},{"location":"high_level/#Minc2.read_volume","page":"High level functions","title":"Minc2.read_volume","text":"read_volume(fn::String; store::Type{T}=Float64)::Volume3D{T}\n\nRead Volume3D from minc file\n\nfn - filename\nstore - underlying array type\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.read_nifti_volume","page":"High level functions","title":"Minc2.read_nifti_volume","text":"read_nifti_volume(fn::AbstractString; store::Type{T}=Float64)::Volume3D{T}\n\nRead Volume3D from .nii or .nii.gz file\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Saving-3D-volumes","page":"High level functions","title":"Saving 3D volumes","text":"","category":"section"},{"location":"high_level/","page":"High level functions","title":"High level functions","text":"Minc2.save_volume\nMinc2.save_nifti_volume","category":"page"},{"location":"high_level/#Minc2.save_volume","page":"High level functions","title":"Minc2.save_volume","text":"save_volume(fn::AbstractString, \n vol::Volume3D{T,N}; \n store::Type{S}=Float32,\n history=nothing)\n\nSave Volume3D to minc file\n\nfn - filename\nvol - Volume3D to save\nstore - underlying MINC data type, to be used for storage\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.save_nifti_volume","page":"High level functions","title":"Minc2.save_nifti_volume","text":"save_nifti_volume(fn::AbstractString, vol::Volume3D{T}; \n store::Type{S}=Float32, history=nothing)\n\nSave Volume3D into .nii or .nii.gz file\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Loading-transformations","page":"High level functions","title":"Loading transformations","text":"","category":"section"},{"location":"high_level/","page":"High level functions","title":"High level functions","text":"Minc2.read_transforms\nMinc2.read_itk_nifti_transform\nMinc2.read_ants_transform","category":"page"},{"location":"high_level/#Minc2.read_transforms","page":"High level functions","title":"Minc2.read_transforms","text":"read_transforms(fname::String)::Vector{AnyTransform}\n\nRead transformations from .xfm file fname\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.read_itk_nifti_transform","page":"High level functions","title":"Minc2.read_itk_nifti_transform","text":"read_itk_nifti_transform(fn::AbstractString;\n store::Type{T}=Float32)::Minc2.GridTransform{Float64,T}\n\nRead ANTs style warp transform\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.read_ants_transform","page":"High level functions","title":"Minc2.read_ants_transform","text":"read_ants_transform(fn::AbstractString; store::Type{T}=Float32)::Minc2.AnyTransform\n\nRead .txt and .nii(.nii.gz) transforms produces by ANTs\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Saving-transformations","page":"High level functions","title":"Saving transformations","text":"","category":"section"},{"location":"high_level/","page":"High level functions","title":"High level functions","text":"Minc2.save_transforms\nMinc2.save_itk_nifti_transform\nMinc2.save_itk_txt_transform","category":"page"},{"location":"high_level/#Minc2.save_transforms","page":"High level functions","title":"Minc2.save_transforms","text":"save_transforms(fname::String, \n xfm::Union{Vector{XFM}, XFM};\n grid_store::Type{T}=Float32 ) where {T, XFM<:AnyTransform}\n\nSave transformations into .xfm file, \n\nArguments\n\nfname: output file name\nxfm: vector of transformations to save, or a single transformation\ngrid_store: type of storage for grid files (default: Float32)\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.save_itk_nifti_transform","page":"High level functions","title":"Minc2.save_itk_nifti_transform","text":"save_itk_nifti_transform(fn::AbstractString,\n xfm::Minc2.GridTransform{Float64,T}; store::Type{S}=Float32)\n\nWrite ANTs style warp transform\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.save_itk_txt_transform","page":"High level functions","title":"Minc2.save_itk_txt_transform","text":"save_itk_txt_transform(fn::AbstractString,\n xfm::Minc2.AffineTransform{Float64})\n\nWrite affine transform in ITK .txt format\n\n\n\n\n\n","category":"function"},{"location":"high_level/#3D-Volume-creation","page":"High level functions","title":"3D Volume creation","text":"","category":"section"},{"location":"high_level/","page":"High level functions","title":"High level functions","text":"Minc2.Volume3D\nMinc2.empty_volume_like\nMinc2.full_volume_like","category":"page"},{"location":"high_level/#Minc2.Volume3D","page":"High level functions","title":"Minc2.Volume3D","text":"Volume3D{T,N}\n\nAn abstract 3D volume, could be vector field or volume with time dimension\n\n\n\n\n\n","category":"type"},{"location":"high_level/#Minc2.empty_volume_like","page":"High level functions","title":"Minc2.empty_volume_like","text":"empty_volume_like(\n fn::String; \n store::Type{T}=Float64, history=nothing)::Volume3D{T}\n\nCreate an empty Volume3D\n\nfn - filename of a minc file that is used for sampling information\nstore - underlying array type\n\n\n\n\n\nempty_volume_like(\n vol::Volume3D{T1,N}; \n store::Type{T}=Float64, \n history=nothing)\n\nCreate an empty Volume3D\n\nvol - Volume3D that is used for sampling information\nstore - underlying array type\nhistory - minc history\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.full_volume_like","page":"High level functions","title":"Minc2.full_volume_like","text":"full_volume_like(\n fn::String,\n fill::T=zero(T); \n store::Type{T}=Float64, history=nothing)::Volume3D{T}\n\nCreate an empty Volume3D\n\nfn - filename of a minc file that is used for sampling information\nstore - underlying array type\n\n\n\n\n\nfull_volume_like(\n vol::Volume3D{T1,N}; \n store::Type{T}=Float64, \n history=nothing)\n\nCreate an empty Volume3D\n\nvol - Volume3D that is used for sampling information\nstore - underlying array type\nhistory - minc history\n\n\n\n\n\n","category":"function"},{"location":"high_level/#3D-Volume-manipulations","page":"High level functions","title":"3D Volume manipulations","text":"","category":"section"},{"location":"high_level/","page":"High level functions","title":"High level functions","text":"Minc2.resample_volume\nMinc2.resample_volume!\nMinc2.resample_grid\nMinc2.resample_grid!\nMinc2.crop_volume","category":"page"},{"location":"high_level/#Minc2.resample_volume","page":"High level functions","title":"Minc2.resample_volume","text":"resample_volume(\n in_vol::Volume3D{T,3};\n like::Union{Volume3D{O,3},Nothing}=nothing,\n tfm::Union{Vector{XFM},XFM,Nothing}=nothing, \n itfm::Union{Vector{XFM},XFM,Nothing}=nothing, \n interp::I=nothing, \n fill=0.0,\n order=1,\n ftol=1.0/80,\n max_iter=10)::Volume3D\n\nResample Volume3D using transformation \n\nin_vol - input Volume3D\nlike - Volume3D that is used for sampling information\nitfm - inverse of the transformation to apply (i.e from output to input)\ntfm - transformation to apply (i.e from output to input) (instead of itfm)\ninterp - interpolation method\nfill - fill value\nftol - tolerance, for inverse transformations\nmax_iter - maximum number of iterations, for inverse transformations\n\nEquivalent to mincresample minc command\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.resample_volume!","page":"High level functions","title":"Minc2.resample_volume!","text":"resample_volume!(in_vol::AbstractArray{T,3}, \n out_vol::AbstractArray{T,3}, \n v2w::AffineTransform{C}, \n w2v::AffineTransform{C}, \n itfm::Union{Vector{XFM},XFM};\n interp::I=BSpline(Quadratic(Line(OnCell()))),\n fill=0.0,\n ftol=1.0/80,\n max_iter=10)\n\nResample 3D array using transformation \n\nin_vol - input 3D array\nout_vol - output 3D array\nv2w - voxel to world affine transform in the output array\nw2v - world to voxel affine transform in the input array\nitfm - inverse of the transformation to apply (i.e from output to input)\ninterp - interpolation method\nfill - fill value\nftol - tolerance, for inverse transformations\nmax_iter - maximum number of iterations, for inverse transformations\n\n\n\n\n\nresample_volume!(\n in_vol::Volume3D{T,3}, \n out_vol::Volume3D{O,3}; \n tfm::Union{Vector{XFM},XFM,Nothing}=nothing, \n itfm::Union{Vector{XFM},XFM,Nothing}=nothing, \n interp::I=nothing, \n fill=0.0, \n order=nothing,\n ftol=1.0/80,\n max_iter=10)::Volume3D{O,3}\n\nResample Volume3D using transformation \n\nin_vol - input Volume3D\nout_vol - output Volume3D\nitfm - inverse of the transformation to apply (i.e from output to input)\ntfm - transformation to apply (i.e from output to input) (instead of itfm)\ninterp - interpolation method\nfill - fill value\nftol - tolerance, for inverse transformations\nmax_iter - maximum number of iterations, for inverse transformations\n\nEquivalent to mincresample minc command\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.resample_grid","page":"High level functions","title":"Minc2.resample_grid","text":"resample_grid(\n in_grid::Volume3D{T,4}, \n itfm::Union{Vector{XFM}, XFM}; \n like::Union{Nothing,Volume3D{L,4}}=nothing)::Volume3D{T,4}\n\nResample Volume3D that contain 4D array, using transformation, assume 1st dimension is non spatial\n\nin_grid - input Volume3D with 4D array describing vector field\nitfm - inverse of the transformation to apply (i.e from output to input)\nlike - Volume3D that is used for sampling information\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.resample_grid!","page":"High level functions","title":"Minc2.resample_grid!","text":"resample_grid!(\n in_grid::Volume3D{T,4},\n out_grid::Volume3D{T,4},\n itfm::Union{Vector{XFM}, XFM}=nothing)::Volume3D{T,4}\n\nResample Volume3D that contain 4D array, using transformation, assume 1st dimension is non spatial\n\nin_grid - input Volume3D with 4D array describing vector field\nout_grid - output Volume3D with 4D array describing vector field\nitfm - inverse of the transformation to apply (i.e from output to input)\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.crop_volume","page":"High level functions","title":"Minc2.crop_volume","text":"crop_volume(in_vol::Volume3D{T,N},crop;\n fill_val::T=zero(T))::Volume3D{T,N}\n\nCrop (or pad) a volume\n\nin_vol - input Volume3D\ncrop - crop specification for each direction, e.g. [(10,10),(20,20),(5,10)] , negative values mean padding\n\n\n\n\n\n","category":"function"},{"location":"high_level/#3D-Volume-and-geometrical-transformation-link","page":"High level functions","title":"3D Volume and geometrical transformation link","text":"","category":"section"},{"location":"high_level/","page":"High level functions","title":"High level functions","text":"Minc2.calculate_jacobian\nMinc2.calculate_jacobian!\nMinc2.GridTransform\nMinc2.InverseGridTransform\nMinc2.tfm_to_grid\nMinc2.normalize_tfm","category":"page"},{"location":"high_level/#Minc2.calculate_jacobian","page":"High level functions","title":"Minc2.calculate_jacobian","text":"calculate_jacobian(\n tfm::Union{Vector{XFM},XFM};\n like::Volume3D{T,3}; \n interp::I=BSpline(Quadratic(Line(OnCell()))),\n ftol=1.0/80,\n max_iter=10)::Volume3D{T,3}\n\nCalculate dense jacobian determinant field for an arbitrary transformation\n\ntfm - transformation to use\nout_vol - output Volume3D\ninterp - interpolation method\nftol - tolerance, for inverse transformations\nmax_iter - maximum number of iterations, for inverse transformations\n\nRoughly equivalent to mincblob minc command\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.calculate_jacobian!","page":"High level functions","title":"Minc2.calculate_jacobian!","text":"calculate_jacobian!(\n tfm::Union{Vector{XFM},XFM},\n out_vol::AbstractArray{T,3},\n out_v2w::AffineTransform{C};\n interp::I=BSpline(Quadratic(Line(OnCell()))),\n ftol=1.0/80,\n max_iter=10)\n\nCalculate dense jacobian determinant field for an arbitrary transformation\n\ntfm - transformation to use\nout_vol - output 3D array\nout_v2w - voxel to world affine transform in the output array\ninterp - interpolation method\nftol - tolerance, for inverse transformations\nmax_iter - maximum number of iterations, for inverse transformations\n\nRoughly equivalent to mincblob minc command\n\n\n\n\n\ncalculate_jacobian!(\n tfm::Union{Vector{XFM},XFM}, \n out_vol::Volume3D{T,3}; \n interp::I=BSpline(Quadratic(Line(OnCell()))),\n ftol=1.0/80,\n max_iter=10)::Volume3D{T,3}\n\nCalculate dense jacobian determinant field for an arbitrary transformation\n\ntfm - transformation to use\nout_vol - output Volume3D\ninterp - interpolation method\nftol - tolerance, for inverse transformations\nmax_iter - maximum number of iterations, for inverse transformations\n\nRoughly equivalent to mincblob minc command\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.tfm_to_grid","page":"High level functions","title":"Minc2.tfm_to_grid","text":"tfm_to_grid(\n tfm::Union{Vector{XFM}, XFM},\n ref::G;\n store::Type{T}=Float64,ftol=1.0/80,max_iter=10)::Volume3D{T,4}\n\nConvert arbitrary transformation into Volume3D with 4D array containing vector field\n\ntfm - transformation to use\nv2w - voxel to world affine transform in the output array\nftol - tolerance, for inverse transformations\nmax_iter - maximum number of iterations, for inverse transformations\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.normalize_tfm","page":"High level functions","title":"Minc2.normalize_tfm","text":"normalize_tfm(tfm::Union{Vector{XFM}, XFM},\n ref::G;\n store::Type{T}=Float64,ftol=1.0/80,max_iter=10)::GridTransform{Float64,T}\n\nConvert arbitrary transformation into a single GridTransform\n\ntfm - transformation to use\nref - GridTransform that is used for sampling information\nstore - underlying array type\nftol - tolerance, for inverse transformations\nmax_iter - maximum number of iterations, for inverse transformations\n\n\n\n\n\nnormalize_tfm(tfm::Union{Vector{XFM}, XFM},\n ref::G;\n store::Type{T}=Float64,ftol=1.0/80,max_iter=10)::GridTransform{Float64,T}\n\nConvert arbitrary transformation into a single GridTransform\n\ntfm - transformation to use\nref - Volume3D that is used for sampling information\nstore - underlying array type\nftol - tolerance, for inverse transformations\nmax_iter - maximum number of iterations, for inverse transformations\n\n\n\n\n\n","category":"function"},{"location":"geo/","page":"Gemetric transformation functions","title":"Gemetric transformation functions","text":"CurrentModule = Minc2\n\nDocTestSetup = quote\n using Minc2\nend","category":"page"},{"location":"geo/#Functions-for-gemetric-transformations","page":"Gemetric transformation functions","title":"Functions for gemetric transformations","text":"","category":"section"},{"location":"geo/","page":"Gemetric transformation functions","title":"Gemetric transformation functions","text":"Modules = [Minc2]\nPages = [\n \"geo_transform.jl\",\n]\nOrder = [:macro, :function, :type, :constant, ]","category":"page"},{"location":"geo/#Base.length-Tuple{Minc2.AnyTransform}","page":"Gemetric transformation functions","title":"Base.length","text":"Base.length(tr::AnyTransform)\n\nLength of concatenated transform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Base.show-Union{Tuple{I}, Tuple{F}, Tuple{T}, Tuple{IO, Minc2.GridTransform{T, F, I}}} where {T, F, I}","page":"Gemetric transformation functions","title":"Base.show","text":"Base.show(io::IO, z::GridTransform{T,F,I})\n\nPrint summary information about grid transform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Base.show-Union{Tuple{I}, Tuple{F}, Tuple{T}, Tuple{IO, Minc2.InverseGridTransform{T, F, I}}} where {T, F, I}","page":"Gemetric transformation functions","title":"Base.show","text":"Base.show(io::IO, z::InverseGridTransform{T,F,I})\n\nPrint summary information about inverse grid transform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.array-Tuple{Minc2.GridTransform}","page":"Gemetric transformation functions","title":"Minc2.array","text":"array(grid::GridTransform)\n\nExtract underlying plain array\n\ngrid - GridTransform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.array-Tuple{Minc2.InverseGridTransform}","page":"Gemetric transformation functions","title":"Minc2.array","text":"array(grid::InverseGridTransform)\n\nExtract underlying plain array\n\ngrid - InverseGridTransform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.decompose-Tuple{Any, Any}","page":"Gemetric transformation functions","title":"Minc2.decompose","text":"decompose(rot, shift)\n\nDecompose affine transform specified as rotation matrix ans shift vector into three components start, step, direction cosines\n\nrot - rotation matrix (3x3)\nshift - shift vector (3)\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.decompose-Union{Tuple{Matrix{T}}, Tuple{T}} where T","page":"Gemetric transformation functions","title":"Minc2.decompose","text":"decompose(tfm::Matrix{T})\n\nDecompose affine transform into three components start, step, direction cosines\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.decompose-Union{Tuple{Minc2.AffineTransform{T}}, Tuple{T}} where T","page":"Gemetric transformation functions","title":"Minc2.decompose","text":"decompose(tfm::AffineTransform{T})\n\nDecompose affine transform into three components start, step, direction cosines\n\ntfm - affine transform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.interpolate_field-Union{Tuple{I}, Tuple{T}, Tuple{Minc2.AffineTransform{T}, I, StaticArraysCore.SVector{3, T}}} where {T, I<:Interpolations.Extrapolation}","page":"Gemetric transformation functions","title":"Minc2.interpolate_field","text":"interpolate_field(\n v2w::AffineTransform{T},\n itp_vector_field::I, \n p::SVector{3,T} )::SVector{3,T}\n\nInternal support function\n\nv2w - voxel to world affine transform\nitp_vector_field - vector field\np - point to transform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.inv-Tuple{Minc2.IdentityTransform}","page":"Gemetric transformation functions","title":"Minc2.inv","text":"inv(::IdentityTransform)::IdentityTransform\n\nInvert IdentityTransform transform, does nothing\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.inv-Union{Tuple{Minc2.AffineTransform{T}}, Tuple{T}} where T","page":"Gemetric transformation functions","title":"Minc2.inv","text":"inv(t::AffineTransform{T})::AffineTransform{T}\n\nInvert AffineTransform transform\n\nt - AffineTransform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.inv-Union{Tuple{Minc2.GridTransform{T, F, VF}}, Tuple{VF}, Tuple{F}, Tuple{T}} where {T, F, VF}","page":"Gemetric transformation functions","title":"Minc2.inv","text":"inv(t::GridTransform{T,F,VF})::InverseGridTransform{T,F,VF}\n\nInvert GridTransform transform\n\nt - GridTransform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.inv-Union{Tuple{Minc2.InverseGridTransform{T, F, VF}}, Tuple{VF}, Tuple{F}, Tuple{T}} where {T, F, VF}","page":"Gemetric transformation functions","title":"Minc2.inv","text":"inv(t::InverseGridTransform{T,F,VF})::GridTransform{T,F,VF}\n\nInvert InverseGridTransform transform\n\nt - InverseGridTransform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.inv-Union{Tuple{Vector{T}}, Tuple{T}} where T<:Minc2.AnyTransform","page":"Gemetric transformation functions","title":"Minc2.inv","text":"inv(t::Vector{T})::Vector{AnyTransform}\n\nInvert concatenated transform\n\nt - concatenated transform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.transform_point-Union{Tuple{F}, Tuple{T}, Tuple{Minc2.GridTransform{T, F, I} where I, StaticArraysCore.SVector{3, T}}} where {T, F}","page":"Gemetric transformation functions","title":"Minc2.transform_point","text":"transform_point(\n tfm::GridTransform{T,F}, p::SVector{3,T};\n _whatever...)::SVector{3,T} where {T,F}\n\nApply forward grid transform to a point\n\ntfm - grid transform\np - point to transform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.transform_point-Union{Tuple{F}, Tuple{T}, Tuple{Minc2.InverseGridTransform{T, F, VF} where VF, StaticArraysCore.SVector{3, T}}} where {T, F}","page":"Gemetric transformation functions","title":"Minc2.transform_point","text":"transform_point(\n tfm::AffineTransform{T}, \n p::CartesianIndex{3};\n _whatever...)::SVector{3,T}\n\nApply inverse grid transform reimplements algorithm from MNIformats/gridtransforms.c:gridinversetransform_point\n\ntfm - affine transform\np - point to transform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.transform_point-Union{Tuple{T}, Tuple{Minc2.AffineTransform{T}, CartesianIndex{3}}} where T","page":"Gemetric transformation functions","title":"Minc2.transform_point","text":"transform_point(\n tfm::AffineTransform{T}, \n p::CartesianIndex{3};\n _whatever...)::SVector{3,T}\n\nApply affine transform to CartesianIndices\n\ntfm - affine transform\np - point to transform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.transform_point-Union{Tuple{T}, Tuple{Minc2.AffineTransform{T}, StaticArraysCore.SVector{3, T}}} where T","page":"Gemetric transformation functions","title":"Minc2.transform_point","text":"transform_point(\n tfm::AffineTransform{T}, \n p::SVector{3,T};\n _whatever...)::SVector{3,T}\n\nApply affine transform to a point\n\ntfm - affine transform\np - point to transform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.transform_point-Union{Tuple{T}, Tuple{Minc2.IdentityTransform, StaticArraysCore.SVector{3, T}}} where T","page":"Gemetric transformation functions","title":"Minc2.transform_point","text":"transform_point(tfm::IdentityTransform, \n p::SVector{3,T};\n _whatever...)\n\ntfm - IdentityTransform\np - point to transform\n\nApply identity transform to a point (returns same point)\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.transform_point-Union{Tuple{T}, Tuple{XFM}, Tuple{Vector{XFM}, StaticArraysCore.SVector{3, T}}} where {XFM<:Minc2.AnyTransform, T}","page":"Gemetric transformation functions","title":"Minc2.transform_point","text":"transform_point(\n tfm::Vector{XFM},\n p::SVector{3,T};\n max_iter::Int=10,\n ftol::Float64=1.0/80)::SVector{3,T}\n\nApply concatenated transform to a point\n\ntfm - concatenated transform\np - point to transform\nmax_iter - maximum number of iterations for inverse transform\nftol - tolerance for inverse transform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.voxel_to_world-Tuple{Minc2.GridTransform}","page":"Gemetric transformation functions","title":"Minc2.voxel_to_world","text":"voxel_to_world(grid::GridTransform)\n\nExtract voxel to world affine transform from a GridTransform\n\ngrid - GridTransform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.voxel_to_world-Tuple{Minc2.InverseGridTransform}","page":"Gemetric transformation functions","title":"Minc2.voxel_to_world","text":"voxel_to_world(grid::InverseGridTransform)\n\nExtract voxel to world affine transform from a InverseGridTransform\n\ngrid - InverseGridTransform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.world_to_voxel-Tuple{Minc2.GridTransform}","page":"Gemetric transformation functions","title":"Minc2.world_to_voxel","text":"world_to_voxel(grid::GridTransform)\n\nExtract world to voxel affine transform from a GridTransform\n\ngrid - GridTransform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.world_to_voxel-Tuple{Minc2.InverseGridTransform}","page":"Gemetric transformation functions","title":"Minc2.world_to_voxel","text":"world_to_voxel(grid::InverseGridTransform)\n\nExtract world to voxel affine transform from a InverseGridTransform\n\ngrid - InverseGridTransform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.AffineTransform","page":"Gemetric transformation functions","title":"Minc2.AffineTransform","text":"AffineTransform{T}\n\nAffine transform, described by rotation matrix and shift vector\n\n\n\n\n\n","category":"type"},{"location":"geo/#Minc2.AffineTransform-Tuple{Any, Any}","page":"Gemetric transformation functions","title":"Minc2.AffineTransform","text":"AffineTransform(rot, shift) Create affine transform from rotation and shift\n\nrot - rotation matrix-like (3x3)\nshift - shift vector-like (3)\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.AffineTransform-Tuple{Any}","page":"Gemetric transformation functions","title":"Minc2.AffineTransform","text":"AffineTransform(mat) Create affine transform from a matrix-like object\n\nmat - matrix (4x4 or 3x4)\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.AnyTransform","page":"Gemetric transformation functions","title":"Minc2.AnyTransform","text":"AnyTransform()\n\nAny 3D Geometrical transform, abstract type\n\n\n\n\n\n","category":"type"},{"location":"geo/#Minc2.GeoTransforms","page":"Gemetric transformation functions","title":"Minc2.GeoTransforms","text":"GeoTransforms=Vector{AnyTransform}\n\nConcatenated transforms\n\n\n\n\n\n","category":"type"},{"location":"geo/#Minc2.GridTransform","page":"Gemetric transformation functions","title":"Minc2.GridTransform","text":"GridTransform{T,F,I}\n\nDense vector field transform (grid transform)\n\n\n\n\n\n","category":"type"},{"location":"geo/#Minc2.GridTransform-Union{Tuple{F}, Tuple{T}, Tuple{Minc2.AffineTransform{T}, Array{F, 4}}} where {T, F}","page":"Gemetric transformation functions","title":"Minc2.GridTransform","text":"GridTransform(\n voxel_to_world::AffineTransform{T},\n vector_field::Array{F, 4})\n\nConstruct GridTransform from voxel to world transform and a vector field\n\nvoxel_to_world - voxel to world affine transform\nvector_field - vector field\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.GridTransform-Union{Tuple{}, Tuple{Type{T}}, Tuple{F}, Tuple{T}, Tuple{Type{T}, Type{F}}} where {T, F}","page":"Gemetric transformation functions","title":"Minc2.GridTransform","text":"GridTransform(::Type{T}=Float64,::Type{F}=Float64)\n\nConstruct empty GridTransform, which should generate identity transform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.IdentityTransform","page":"Gemetric transformation functions","title":"Minc2.IdentityTransform","text":"IdentityTransform()\n\nIdentity transform, does nothing\n\n\n\n\n\n","category":"type"},{"location":"geo/#Minc2.InverseGridTransform","page":"Gemetric transformation functions","title":"Minc2.InverseGridTransform","text":"InverseGridTransform{T,F,VF}\n\nDense vector field transform (GridTransform) used in inverse\n\n\n\n\n\n","category":"type"},{"location":"geo/#Minc2.InverseGridTransform-Union{Tuple{F}, Tuple{T}, Tuple{Minc2.AffineTransform{T}, Array{F, 4}}} where {T, F}","page":"Gemetric transformation functions","title":"Minc2.InverseGridTransform","text":"InverseGridTransform(\n voxel_to_world::AffineTransform{T},\n vector_field::Array{F, 4})\n\nConstruct InverseGridTransform from voxel to world transform and a vector field\n\nvoxel_to_world - voxel to world affine transform\nvector_field - vector field\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.InverseGridTransform-Union{Tuple{}, Tuple{Type{T}}, Tuple{F}, Tuple{T}, Tuple{Type{T}, Type{F}}} where {T, F}","page":"Gemetric transformation functions","title":"Minc2.InverseGridTransform","text":"InverseGridTransform(::Type{T}=Float64,::Type{F}=Float64)\n\nConstruct InverseGridTransform empty transform\n\n\n\n\n\n","category":"method"},{"location":"low_level/","page":"Low level functions","title":"Low level functions","text":"CurrentModule = Minc2\n\nDocTestSetup = quote\n using Minc2\nend","category":"page"},{"location":"low_level/#Low-level-functions-for-IO-on-.mnc-and-.xfm-files","page":"Low level functions","title":"Low level functions for IO on .mnc and .xfm files","text":"","category":"section"},{"location":"low_level/","page":"Low level functions","title":"Low level functions","text":"Modules = [Minc2]\nPages = [\n \"minc2_io.jl\",\n \"xfm_io.jl\",\n]\nOrder = [:macro, :function, :type, :constant, ]","category":"page"},{"location":"low_level/#Minc2.@minc2_check-Tuple{Any}","page":"Low level functions","title":"Minc2.@minc2_check","text":"minc2_check( ex )\n\nMacro to verify the return code\n\n\n\n\n\n","category":"macro"},{"location":"low_level/#Minc2._hdr_convert!-Tuple{Minc2.MincHeader, Any}","page":"Low level functions","title":"Minc2._hdr_convert!","text":"_hdr_convert!(hdr::MincHeader,dd)::MincHeader\n\ninternal function\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.attributes-Tuple{Minc2.VolumeHandle, String}","page":"Low level functions","title":"Minc2.attributes","text":"attributes(h::VolumeHandle, g::String)\n\nList attributes defined inside given group\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.close_minc_file-Tuple{Minc2.VolumeHandle}","page":"Low level functions","title":"Minc2.close_minc_file","text":"close_minc_file(h::VolumeHandle)\n\nClose currently open minc file, commit data on disk\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.copy_minc_metadata-Tuple{Minc2.VolumeHandle, Minc2.VolumeHandle}","page":"Low level functions","title":"Minc2.copy_minc_metadata","text":"copy_minc_metadata(i::VolumeHandle, o::VolumeHandle)\n\nCopy metadata from one file to another\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.create_header_from_v2w-Union{Tuple{T}, Tuple{Any, Minc2.AffineTransform{T}}} where T","page":"Low level functions","title":"Minc2.create_header_from_v2w","text":"create_header_from_v2w(\n sz, t::AffineTransform{T};\n vector_dim::Bool=false, \n time_step::Union{Float64,Nothing}=nothing,\n time_start::Union{Float64,Nothing}=nothing)::MincHeader\n\nInternal: Generate header from the voxel to world transform and volume size\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.create_minc_file-Tuple{Minc2.VolumeHandle, AbstractString}","page":"Low level functions","title":"Minc2.create_minc_file","text":"create_minc_file(h::VolumeHandle, path::AbstractString)\n\nCreate empty minc file on disk, structure need to be defined in advance\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.define_minc_file-Union{Tuple{Minc2.MincHeader}, Tuple{Repr}, Tuple{Store}, Tuple{Minc2.MincHeader, Type{Store}}, Tuple{Minc2.MincHeader, Type{Store}, Type{Repr}}} where {Store, Repr}","page":"Low level functions","title":"Minc2.define_minc_file","text":"define_minc_file(hdr::MincHeader,::Type{Store}=Float32,::Type{Repr}=Store)\n\nDefine new minc file structure, return handle\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.empty_like_minc_volume_raw-Union{Tuple{Minc2.VolumeHandle}, Tuple{T}, Tuple{Minc2.VolumeHandle, Type{T}}} where T<:Number","page":"Low level functions","title":"Minc2.empty_like_minc_volume_raw","text":"empty_like_minc_volume_raw( h::VolumeHandle,\n ::Type{T}=Float32 )::Tuple{Array{T}, Minc2.MincHeader}\n\nAllocate empty volume using handle return volume, storage header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.empty_like_minc_volume_raw-Union{Tuple{String}, Tuple{T}, Tuple{String, Type{T}}} where T<:Number","page":"Low level functions","title":"Minc2.empty_like_minc_volume_raw","text":"empty_like_minc_volume_raw(path::String, ::Type{T}=Float32 )::\n Tuple{Array{T}, Minc2.MincHeader}\n\nCreate empty volume similar to existing file return volume, representation header,storage header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.empty_like_minc_volume_std-Union{Tuple{Minc2.VolumeHandle}, Tuple{T}, Tuple{Minc2.VolumeHandle, Type{T}}} where T<:Number","page":"Low level functions","title":"Minc2.empty_like_minc_volume_std","text":"empty_like_minc_volume_std(h::VolumeHandle, \n ::Type{T}=Float32 )::Tuple{Array{T}, Minc2.MincHeader, Minc2.MincHeader}\n\nRead the actual volume using handle return volume, representation header,storage header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.empty_like_minc_volume_std-Union{Tuple{String}, Tuple{T}, Tuple{String, Type{T}}} where T<:Number","page":"Low level functions","title":"Minc2.empty_like_minc_volume_std","text":"empty_like_minc_volume_std(path::String, \n ::Type{T}=Float32 )::Tuple{Array{T}, Minc2.MincHeader, Minc2.MincHeader}\n\nallocate empty volume using path as a reference return volume, representation header,storage header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.empty_like_minc_volume_std_history-Union{Tuple{String}, Tuple{T}, Tuple{String, Type{T}}} where T<:Number","page":"Low level functions","title":"Minc2.empty_like_minc_volume_std_history","text":"empty_like_minc_volume_std_history(path::String, ::Type{T}=Float32 )\n\nallocate empty volume using path return volume, representation header,storage header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.get_attribute-Tuple{Minc2.VolumeHandle, String, String}","page":"Low level functions","title":"Minc2.get_attribute","text":"get_attribute(h::VolumeHandle,g::String,a::String; default=missing)\n\nConvenience function for reading specific attribute, return default value if not found also convert Array into the first value if it's a one-length array\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.groups-Tuple{Minc2.VolumeHandle}","page":"Low level functions","title":"Minc2.groups","text":"groups(h::VolumeHandle)\n\nList groups defined in minc2 file\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.minc2_load_and_convert_complete_volume-Union{Tuple{Tout}, Tuple{Tin}, Tuple{Minc2.VolumeHandle, Array{Tin, N} where N, Type{Tout}}} where {Tin<:Number, Tout<:Number}","page":"Low level functions","title":"Minc2.minc2_load_and_convert_complete_volume","text":"Internal function that makes sure types are compatible\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.minc2_load_and_convert_complete_volume-Union{Tuple{Tout}, Tuple{Tin}, Tuple{Minc2.VolumeHandle, Array{Tin, N} where N, Type{Tout}}} where {Tin<:Real, Tout<:Integer}","page":"Low level functions","title":"Minc2.minc2_load_and_convert_complete_volume","text":"Internal function that makes sure types are compatible\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.ndim-Tuple{Minc2.VolumeHandle}","page":"Low level functions","title":"Minc2.ndim","text":"ndim(h::VolumeHandle)::Int\n\nQuery number of dimensions in the minc file\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.open_minc_file-Tuple{String}","page":"Low level functions","title":"Minc2.open_minc_file","text":"open_minc_file(fname::String)::VolumeHandle\n\nOpen minc file, return handle\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.read_attribute-Tuple{Minc2.VolumeHandle, String, String}","page":"Low level functions","title":"Minc2.read_attribute","text":"read_attribute(h::VolumeHandle, \n group::String,\n attribute::String)::Union{String, AbstractVector, Nothing}\n\nRead minc2 header attribute :param group: attribute group name :param attribute: attribute name :return:\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.read_history-Tuple{Minc2.VolumeHandle}","page":"Low level functions","title":"Minc2.read_history","text":"read_history(i::VolumeHandle)::Union{String, Nothing}\n\nReturn history string\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.read_minc_volume_raw-Union{Tuple{Minc2.VolumeHandle}, Tuple{T}, Tuple{Minc2.VolumeHandle, Type{T}}} where T<:Number","page":"Low level functions","title":"Minc2.read_minc_volume_raw","text":"read_minc_volume_raw(h::VolumeHandle, \n ::Type{T}=Float32 )::Tuple{Array{T}, Minc2.MincHeader}\n\nRead the actual volume using handle return volume, storage header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.read_minc_volume_raw-Union{Tuple{String}, Tuple{T}, Tuple{String, Type{T}}} where T<:Number","page":"Low level functions","title":"Minc2.read_minc_volume_raw","text":"read_minc_volume_raw(path::String, ::Type{T}=Float32 )::\n Tuple{Array{T}, Minc2.MincHeader}\n\nRead the actual volume using path return volume, representation header,storage header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.read_minc_volume_raw_history-Union{Tuple{String}, Tuple{T}, Tuple{String, Type{T}}} where T<:Number","page":"Low level functions","title":"Minc2.read_minc_volume_raw_history","text":"read_minc_volume_raw_history(path::String, ::Type{T}=Float32 )\n\nRead the actual volume using path return volume, representation header,storage header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.read_minc_volume_std-Union{Tuple{Minc2.VolumeHandle}, Tuple{T}, Tuple{Minc2.VolumeHandle, Type{T}}} where T<:Number","page":"Low level functions","title":"Minc2.read_minc_volume_std","text":"read_minc_volume_std(h::VolumeHandle, \n ::Type{T}=Float32 )::Tuple{Array{T}, Minc2.MincHeader, Minc2.MincHeader}\n\nRead the actual volume using handle return volume, representation header,storage header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.read_minc_volume_std-Union{Tuple{String}, Tuple{T}, Tuple{String, Type{T}}} where T<:Number","page":"Low level functions","title":"Minc2.read_minc_volume_std","text":"read_minc_volume_std(path::String, ::Type{T}=Float32 )::\n Tuple{Array{T}, Minc2.MincHeader, Minc2.MincHeader}\n\nRead the actual volume using path return volume, representation header,storage header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.read_minc_volume_std_history-Union{Tuple{String}, Tuple{T}, Tuple{String, Type{T}}} where T<:Number","page":"Low level functions","title":"Minc2.read_minc_volume_std_history","text":"read_minc_volume_std_history(path::String, ::Type{T}=Float32 )::\n Tuple{Array{T}, Minc2.MincHeader, Minc2.MincHeader, Union{String,Nothing}}\n\nRead the actual volume using path return volume, representation header,storage header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.representation_header-Tuple{Minc2.VolumeHandle}","page":"Low level functions","title":"Minc2.representation_header","text":"representation_header(h::VolumeHandle)::MincHeader\n\nReturn volume representation header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.representation_type-Tuple{Minc2.VolumeHandle}","page":"Low level functions","title":"Minc2.representation_type","text":"store_type(h::VolumeHandle)::Type\n\nQuery representation data type of the minc file, WARNING: it doesn't nacessery mean that it's the same as store_type type\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.setup_standard_order-Tuple{Minc2.VolumeHandle}","page":"Low level functions","title":"Minc2.setup_standard_order","text":"setup_standard_order(h::VolumeHandle)\n\nPrepare to read volume in standard order: [V,X,Y,Z,TIME]\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.store_header-Tuple{Minc2.VolumeHandle}","page":"Low level functions","title":"Minc2.store_header","text":"store_header(h::VolumeHandle)::MincHeader\n\nReturn volume on-disk stucture header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.store_type-Tuple{Minc2.VolumeHandle}","page":"Low level functions","title":"Minc2.store_type","text":"store_type(h::VolumeHandle)::Type\n\nQuery storage data type of the minc file, WARNING: it doesn't nacessery mean that it's the same as representation type\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.voxel_to_world-Tuple{Minc2.MincHeader}","page":"Low level functions","title":"Minc2.voxel_to_world","text":"voxel_to_world(hdr::MincHeader)::AffineTransform{Float64}\n\nGive AffineTransform for world to voxel transformation based on header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.voxel_to_world-Tuple{Minc2.VolumeHandle, Vector{Float64}}","page":"Low level functions","title":"Minc2.voxel_to_world","text":"voxel_to_world(h::VolumeHandle,ijk::Vector{Float64})::Vector{Float64}\n\nConvert contignuous 0-based voxel indexes (I,J,K) to world coordinates (X,Y,Z) 0-based\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.world_to_voxel-Tuple{Minc2.MincHeader}","page":"Low level functions","title":"Minc2.world_to_voxel","text":"world_to_voxel(hdr::MincHeader)::AffineTransform{Float64}\n\nGive AffineTransform for voxel to world transformation\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.world_to_voxel-Tuple{Minc2.VolumeHandle, Vector{Float64}}","page":"Low level functions","title":"Minc2.world_to_voxel","text":"world_to_voxel(h::VolumeHandle, xyz::Vector{Float64})::Vector{Float64}\n\nConvert world coordinates (X,Y,Z) to contignuous voxel indexes (I,J,K) 0-based\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.write_attribute-Union{Tuple{T}, Tuple{Minc2.VolumeHandle, String, String, T}} where T","page":"Low level functions","title":"Minc2.write_attribute","text":"write_attribute(h::VolumeHandle, group::String, attribute::String, value::T)\n\nStore attribute into minc2 file :param group: group name :param attribute: attribute name :param value: attribute value :return:\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.write_history-Tuple{Minc2.VolumeHandle, String}","page":"Low level functions","title":"Minc2.write_history","text":"write_history(i::VolumeHandle, history::String)\n\nWrite history string\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.write_minc_volume_raw-Union{Tuple{Repr}, Tuple{Store}, Tuple{String, Type{Store}, Union{Nothing, Minc2.MincHeader}, Array{Repr, N} where N}} where {Store, Repr}","page":"Low level functions","title":"Minc2.write_minc_volume_raw","text":"write_minc_volume_raw(path::String, ::Type{Store}, \n store_hdr::Union{MincHeader, Nothing}, \n volume::Array{Repr};like::Union{String, Nothing}=nothing, \n history::Union{String, Nothing}=nothing )\n\nWrite full volume to file, need to provide details of file structure return nothing\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.write_minc_volume_raw-Union{Tuple{T}, Tuple{Minc2.VolumeHandle, Array{T, N} where N}} where T<:Number","page":"Low level functions","title":"Minc2.write_minc_volume_raw","text":"write_minc_volume_raw(h::VolumeHandle, volume::Array{T} )\n\nwrite full volume to file, file should be defined and created return nothing\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.write_minc_volume_std-Union{Tuple{Repr}, Tuple{Store}, Tuple{String, Type{Store}, Union{Nothing, Minc2.MincHeader}, Array{Repr, N} where N}} where {Store, Repr}","page":"Low level functions","title":"Minc2.write_minc_volume_std","text":"write_minc_volume_std(path::String, ::Type{Store}, \n store_hdr::Union{MincHeader, Nothing}, \n volume::Array{Repr};like::Union{String, Nothing}=nothing, \n history::Union{String, Nothing}=nothing )\n\nWrite full volume to file, need to provide details of file structure return nothing\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.write_minc_volume_std-Union{Tuple{T}, Tuple{Minc2.VolumeHandle, Array{T, N} where N}} where T<:Number","page":"Low level functions","title":"Minc2.write_minc_volume_std","text":"write_minc_volume_std(h::VolumeHandle, volume::Array{T} )\n\nwrite full volume to file, file should be defined and created return nothing\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.DIM","page":"Low level functions","title":"Minc2.DIM","text":"Low Level: Axis types from MINC volume\n\n\n\n\n\n","category":"type"},{"location":"low_level/#Minc2.Minc2Error","page":"Low level functions","title":"Minc2.Minc2Error","text":"MINC io exception\n\n\n\n\n\n","category":"type"},{"location":"low_level/#Minc2.MincHeader","page":"Low level functions","title":"Minc2.MincHeader","text":"MincHeader\n\nStructure describing spatial orientation and sampling of the minc file \n\n\n\n\n\n","category":"type"},{"location":"low_level/#Minc2.STATUS","page":"Low level functions","title":"Minc2.STATUS","text":"Low Level: minc2_simple API status\n\n\n\n\n\n","category":"type"},{"location":"low_level/#Minc2.VolumeHandle","page":"Low level functions","title":"Minc2.VolumeHandle","text":"VolumeHandle\n\nminc2_simple volume handle\n\n\n\n\n\n","category":"type"},{"location":"low_level/#Minc2.julia_to_minc2","page":"Low level functions","title":"Minc2.julia_to_minc2","text":"Low Level: map Julia types to minc2 data types\n\n\n\n\n\n","category":"constant"},{"location":"low_level/#Minc2.minc2_spatial","page":"Low level functions","title":"Minc2.minc2_spatial","text":"Low Level: Mapping MINC2 spatial dimensions to proper spatial dimension (should be identity for spatial dims)\n\n\n\n\n\n","category":"constant"},{"location":"low_level/#Minc2.minc2_to_julia","page":"Low level functions","title":"Minc2.minc2_to_julia","text":"Low Level: map MINC2 types to Julia\n\n\n\n\n\n","category":"constant"},{"location":"low_level/#Minc2.append_grid_transform-Tuple{Minc2.TransformHandle, String}","page":"Low level functions","title":"Minc2.append_grid_transform","text":"append_grid_transform(h::TransformHandle, grid_file::String; inv::Bool=false)\n\nLow level: Append grid transform to an open transformation handle\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.append_linear_transform-Tuple{Minc2.TransformHandle, Minc2.AffineTransform}","page":"Low level functions","title":"Minc2.append_linear_transform","text":"append_linear_transform(h::TransformHandle, lin::AffineTransform)\n\nLow level: Append affine transform to an open transformation handle\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.concat_xfm-Tuple{Minc2.TransformHandle, Minc2.TransformHandle}","page":"Low level functions","title":"Minc2.concat_xfm","text":"concat_xfm(h::TransformHandle, i::TransformHandle)\n\nLow level: concatenate two transfomations\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.get_grid_transform-Tuple{Minc2.TransformHandle}","page":"Low level functions","title":"Minc2.get_grid_transform","text":"get_grid_transform(h::TransformHandle; n::Int64=0)\n\nLow level: extract reference to a grid file from open handle\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.get_linear_transform-Tuple{Minc2.TransformHandle}","page":"Low level functions","title":"Minc2.get_linear_transform","text":"get_linear_transform(h::TransformHandle; n::Int64=0)::AffineTransform{Float64}\n\nLow level: extract AffineTransform{Float64} from open handle\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.get_linear_transform_param-Tuple{Minc2.TransformHandle}","page":"Low level functions","title":"Minc2.get_linear_transform_param","text":"get_linear_transform_param(h::TransformHandle;n::Int64=0,center::Union{Nothing,Vector{Float64}}=nothing)\n\nLow level: extact transformation parameters from affine transform , returns named tuple with fields center, translations, scales, shears, rotations\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.get_n_concat-Tuple{Minc2.TransformHandle}","page":"Low level functions","title":"Minc2.get_n_concat","text":"get_n_concat(h::TransformHandle)::Int64\n\nLow level: Get number of transformations in open handle\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.get_n_type-Tuple{Minc2.TransformHandle}","page":"Low level functions","title":"Minc2.get_n_type","text":"get_n_type(h::TransformHandle; n::Int64=0)::XFM\n\nLow level: Get transform type for nth transform in open handle\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.inverse_transform_point-Tuple{Minc2.TransformHandle, Vector{Float64}}","page":"Low level functions","title":"Minc2.inverse_transform_point","text":"inverse_transform_point(h::TransformHandle, xyz::Vector{Float64})::Vector{Float64}\n\nLow level: Inverse transform point xyz using minc transform h\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.invert_transform-Tuple{Minc2.TransformHandle}","page":"Low level functions","title":"Minc2.invert_transform","text":"invert_transform(h::TransformHandle)\n\nLow level: Invert minc transform h\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.load_transforms-Tuple{Minc2.TransformHandle}","page":"Low level functions","title":"Minc2.load_transforms","text":"load_transforms(h::TransformHandle)::Vector{AnyTransform}\n\nLow level: Load all transforms from open .XFM handle\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.load_transforms-Tuple{String}","page":"Low level functions","title":"Minc2.load_transforms","text":"load_transforms(fname::String)::Vector{AnyTransform}\n\nLoad transformations from .xfm file fname\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.open_xfm_file-Tuple{String}","page":"Low level functions","title":"Minc2.open_xfm_file","text":"Low level: Open transform xfm file, return handle\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.read_transforms-Tuple{String}","page":"Low level functions","title":"Minc2.read_transforms","text":"read_transforms(fname::String)::Vector{AnyTransform}\n\nRead transformations from .xfm file fname\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.save_transforms-Union{Tuple{XFM}, Tuple{T}, Tuple{String, Union{Vector{XFM}, XFM}}} where {T, XFM<:Minc2.AnyTransform}","page":"Low level functions","title":"Minc2.save_transforms","text":"save_transforms(fname::String, \n xfm::Union{Vector{XFM}, XFM};\n grid_store::Type{T}=Float32 ) where {T, XFM<:AnyTransform}\n\nSave transformations into .xfm file, \n\nArguments\n\nfname: output file name\nxfm: vector of transformations to save, or a single transformation\ngrid_store: type of storage for grid files (default: Float32)\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.save_xfm_file-Tuple{Minc2.TransformHandle, String}","page":"Low level functions","title":"Minc2.save_xfm_file","text":"save_xfm_file(h::TransformHandle, path::String)\n\nLow level: Save information into file from an open handle\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.transform_point-Tuple{Minc2.TransformHandle, Vector{Float64}}","page":"Low level functions","title":"Minc2.transform_point","text":"transform_point(h::TransformHandle, xyz::Vector{Float64})::Vector{Float64}\n\nLow level: Transform point xyz using minc transform h\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.TransformHandle","page":"Low level functions","title":"Minc2.TransformHandle","text":"Low level: minc2_simple XFM transform handle\n\n\n\n\n\n","category":"type"},{"location":"low_level/#Minc2.XFM","page":"Low level functions","title":"Minc2.XFM","text":"@enum XFM\n\nLow level: transformation types stored in .xfm file\n\n\n\n\n\n","category":"type"},{"location":"plotting/","page":"Plotting functions","title":"Plotting functions","text":"CurrentModule = Minc2\n\nDocTestSetup = quote\n using Minc2\nend","category":"page"},{"location":"plotting/#High-level-functions-for-plotting-3D-volumes","page":"Plotting functions","title":"High level functions for plotting 3D volumes","text":"","category":"section"},{"location":"plotting/","page":"Plotting functions","title":"Plotting functions","text":"These are helper functions for plotting Volume3D objects using Makie. To make them available one must first load Makie or equivalent (i.e CairoMakie)","category":"page"},{"location":"plotting/#Show-MNI-ICBM152-template-contours-with-tissue-masks-overlays","page":"Plotting functions","title":"Show MNI-ICBM152 template contours with tissue masks overlays","text":"","category":"section"},{"location":"plotting/","page":"Plotting functions","title":"Plotting functions","text":"using CairoMakie\nusing Minc2\n\n# read T1w scan\nicbm=Minc2.read_volume(\"mni_icbm152_t1_tal_nlin_sym_09c.mnc\", store=Float64)\n# read label mask, represent it as array of bytes \nlab=Minc2.read_volume(\"mni_icbm152_cls_tal_nlin_sym_09c.mnc\", store=UInt8)\n\n\nfig = Figure()\ngc = fig[1, 1] = GridLayout()\n\nMinc2.draw_outline_with_labels(gc, icbm, lab, \n labels=Dict([1=>\"CSF\",2=>\"GM\",3=>\"WM\"]),\n nslices = 5)\n\nresize_to_layout!(fig)\n\nsave(\"mni_icbm152_segmentation.png\", fig, px_per_unit = 1)","category":"page"},{"location":"plotting/","page":"Plotting functions","title":"Plotting functions","text":"Will produce (Image: MNI-ICBM152 Segmentation)","category":"page"},{"location":"plotting/","page":"Plotting functions","title":"Plotting functions","text":"Minc2.draw_outline_with_labels","category":"page"},{"location":"plotting/#Minc2.draw_outline_with_labels","page":"Plotting functions","title":"Minc2.draw_outline_with_labels","text":"draw_outline_with_labels(\n layout, \n anat, \n seg; \n labels, \n cmap = :rainbow,\n levels = [20,30],\n show_colorbar = true,\n nslices = 4)\n\nDraws a segmentation seg on top of anat in a grid layout layout\n\nlayout is a grid layout\nanat is a Volume3D with anatomical image\nseg is a Volume3D with discrete segemntations\nlabels is a dictionary of labels to show\ncmap is a color map to use\nlevels is a list of levels of anat to use for contours\nshow_colorbar is a boolean flag to show colorbar\nnslices is a number of slices to show\n\n\n\n\n\n","category":"function"},{"location":"plotting/#Show-MNI-ICBM152-template-contours-with-GM-proability-map","page":"Plotting functions","title":"Show MNI-ICBM152 template contours with GM proability map","text":"","category":"section"},{"location":"plotting/","page":"Plotting functions","title":"Plotting functions","text":"using CairoMakie\nusing Minc2\n\n# read T1w scan\nanat=Minc2.read_volume(\"mni_icbm152_t1_tal_nlin_sym_09c.mnc\",store=Float64)\n# read field\ngm=Minc2.read_volume(\"mni_icbm152_gm_tal_nlin_sym_09c.mnc\",store=Float64)\n\nfig = Figure()\ngc = fig[1, 1] = GridLayout()\n\n# set background to transparent\nMinc2.array(gm)[Minc2.array(gm) .< 1e-6] .= NaN\n\nMinc2.draw_outline_with_heatmap(gc, anat, gm, \n heat_limits=(0.0,1.0),cmap=:turbo,\n nslices = 5)\n\nresize_to_layout!(fig)\n\nsave(\"mni_icbm152_gm.png\", fig, px_per_unit = 1) ","category":"page"},{"location":"plotting/","page":"Plotting functions","title":"Plotting functions","text":"Will produce (Image: MNI-ICBM152 GM)","category":"page"},{"location":"plotting/","page":"Plotting functions","title":"Plotting functions","text":"Minc2.draw_outline_with_heatmap","category":"page"},{"location":"plotting/#Minc2.draw_outline_with_heatmap","page":"Plotting functions","title":"Minc2.draw_outline_with_heatmap","text":"draw_outline_with_heatmap(\n layout, anat, heat; \n cmap=:rainbow, levels=[20, 40],\n heat_limits=nothing, \n show_colorbar=true,\n nslices=4)\n\nDraws a heatmap of heat on top of anat in a grid layout layout.\n\nlayout is a grid layout\nanat is a Volume3D with anatomical image\nheat is a Volume3D with overlay heatmap\nheat_limits limits for the heatmap\ncmap is a color map to use\nlevels is a list of levels of anat to use for contours\nshow_colorbar is a boolean flag to show colorbar\nnslices is a number of slices to show\n\n\n\n\n\n","category":"function"},{"location":"plotting/#Show-two-tailed-t-statistics-on-DBM-style-analysis","page":"Plotting functions","title":"Show two-tailed t-statistics on DBM style analysis","text":"","category":"section"},{"location":"plotting/","page":"Plotting functions","title":"Plotting functions","text":"using CairoMakie\nusing Minc2\n\n# read T1w scan and crop black area around ROI\nanat=Minc2.crop_volume(\n Minc2.read_volume(\"mni_icbm152_t1_tal_nlin_sym_09c.mnc\",store=Float64),\n [[15,15],[20,20],[20,20]])\n\n# Read brain ROI, should be the same sampling as anat\nmask=Minc2.crop_volume(\n Minc2.read_volume(\"mni_icbm152_t1_tal_nlin_sym_09c_mask.mnc\",store=UInt8),\n [[15,15],[20,20],[20,20]])\n\n# read statistics map, does not have to be the same resolution as anat\nvol_t=Minc2.read_volume(\"t_AD_vs_CN_2mm.mnc\",store=Float64)\n\n# statistical limits (two-tailed)\nstat_limits = [2.9 , 5]\n\n# start new figure\nfig = Figure()\n\ng1 = f[1,1] = GridLayout()\nLabel(f[1,1,Top()],\"AD vs CN-\")\n\ndraw_outline_with_heatmap_symmetric(g1, anat, mask, vol_stat;\n heat_limits=stat_limits,\n show_colorbar=true,\n cmap_pos=:YlOrRd_9,cmap_neg=:YlGnBu_9,\n nslices=5,\n colorbar_label=\"t-statistics\")\n\nresize_to_layout!(fig)\n\nsave(\"t-statistics.png\", fig, px_per_unit = 1) ","category":"page"},{"location":"plotting/","page":"Plotting functions","title":"Plotting functions","text":"(Image: T-statistics)","category":"page"},{"location":"plotting/","page":"Plotting functions","title":"Plotting functions","text":"Minc2.draw_outline_with_heatmap_symmetric","category":"page"},{"location":"plotting/#Minc2.draw_outline_with_heatmap_symmetric","page":"Plotting functions","title":"Minc2.draw_outline_with_heatmap_symmetric","text":"draw_outline_with_heatmap_symmetric(\n layout, anat, mask, heat; \n cmap_pos=:YlOrRd_9,\n cmap_neg=:YlGnBu_9,\n levels=[20, 40],\n heat_limits=nothing,\n show_colorbar=true,\n under=nothing, \n over=nothing,\n nslices=4,\n alpha=0.7,\n colorbar_label=\"\",\n slices_gap=5,\n colorbar_gap=10)\n\nDraws a two-sided (symmetric positive and negative) heatmap of heat on top of anat in a grid layout layout.\n\nlayout is a grid layout\nanat is a Volume3D with anatomical image\nmask is a Volume3D with ROI\nheat is a Volume3D with overlay heatmap, can be arbitrary sampling\nheat_limits limits for the heatmap\ncmap_pos is a color map to use for positive values, if nothing then don't show positive values\ncmap_neg is a color map to use for negative values, if nothing then don't show negative values\nlevels is a list of levels of anat to use for contours\nshow_colorbar is a boolean flag to show colorbar\ncolorbar_label is a label for the colorbar\nnslices is a number of slices to show\n\n\n\n\n\n","category":"function"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"CurrentModule = Minc2\n\nDocTestSetup = quote\n using Minc2\nend","category":"page"},{"location":"#MINC2-for-Julia","page":"Introduction to Minc2.jl","title":"MINC2 for Julia","text":"","category":"section"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"(Image: CI)","category":"page"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"Read and write MINC2 files from Julia, reading and writing .xfm transformation files, Manipulations with volumes","category":"page"},{"location":"#Examples","page":"Introduction to Minc2.jl","title":"Examples","text":"","category":"section"},{"location":"#Read-a-3D-minc-volume,-calculate-mean-value","page":"Introduction to Minc2.jl","title":"Read a 3D minc volume, calculate mean value","text":"","category":"section"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"Minc command:","category":"page"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"> mincstats -mean mni_icbm152_t1_tal_nlin_sym_09c.mnc\nMean: 29.61005195","category":"page"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"Julia version:","category":"page"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"using Minc2\nusing StatsBase\n\n# read volume from minc file, represent it as array of doubles (Float64 in julia world)\nicbm=Minc2.read_volume(\"mni_icbm152_t1_tal_nlin_sym_09c.mnc\", store=Float64)\n@show mean(Minc2.array(icbm))","category":"page"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"Output mean(Minc2.array(icbm)) = 29.61005194874031","category":"page"},{"location":"#Read-a-3D-volume-with-real-values,-and-another-one-with-mask-labels-and-show-statistics-per-label","page":"Introduction to Minc2.jl","title":"Read a 3D volume with real values, and another one with mask labels and show statistics per label","text":"","category":"section"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"using Minc2\nusing StatsBase\n\n# read T1w scan\nicbm=Minc2.read_volume(\"mni_icbm152_t1_tal_nlin_sym_09c.mnc\", store=Float64)\n# read label mask, represent it as array of bytes \nlab=Minc2.read_volume(\"mni_icbm152_cls_tal_nlin_sym_09c.mnc\", store=UInt8)\n\n# calculate image statistics per label\nfor (i,l) in [1=>\"CSF\",2=>\"GM\",3=>\"WM\"]\n println(\"$(l):$(mean(Minc2.array(icbm)[ Minc2.array(lab).==i ]))\")\nend","category":"page"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"Output:","category":"page"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"CSF:31.263195070792978\nGM:64.88399427312729\nWM:84.74593912912998","category":"page"},{"location":"#Apply-transformation-stored-in-.xfm-file-to-a-minc-volume,-save-result","page":"Introduction to Minc2.jl","title":"Apply transformation stored in .xfm file to a minc volume, save result","text":"","category":"section"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"Create transformation with minc command:param2xfm -rotations 30 0 0 rotate.xfm","category":"page"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"using Minc2\n\n# read T1w scan\nicbm=Minc2.read_volume(\"mni_icbm152_t1_tal_nlin_sym_09c.mnc\", store=Float64)\n\n# read transformation\ntfm=Minc2.load_transforms(\"rotate.xfm\")\n\n# apply transformation to the volume\ntransformed_icbm=Minc2.resample_volume(icbm; tfm, order=2, fill=0.0)\n\n# write the resulting volume into file, append history\n# the resulting volume will be stored with unsigned short minc data type\n# but will preserve floating point vales used fixe-point arithmetics\nMinc2.save_volume(\"transformed_icbm.mnc\",transformed_icbm, store=UInt16, history=\"Julia example\")","category":"page"},{"location":"#Integrate-jacobians-per-ROI,-based-on-a-transformation-in-.xfm-file","page":"Introduction to Minc2.jl","title":"Integrate jacobians per ROI, based on a transformation in .xfm file","text":"","category":"section"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"using Minc2\n\n# read ROI labels\nrois = Minc2.read_volume(\"rois.mnc\", store=UInt8)\n\n# calculate voxel volume \nstart, step, dir_cos = Minc2.decompose(Minc2.voxel_to_world(rois))\nvoxel_volume = abs(reduce(*,step,init=1))\n\n# read transformation\ntfm = Minc2.load_transforms(\"nonlinear.xfm\")\n\n# define sampling parameters for jacobian field\njacobians = Minc2.empty_volume_like(lab, store=Float64)\n\n# calculate per-voxel jacobians\nMinc2.calculate_jacobian!(tfm, jacobians)\n\n# Integrate per ROI\nfor (i,l) in [1=>\"ROI-1\",2=>\"ROI-2\",3=>\"ROI-3\"]\n println(\"$(l):$( sum((Minc2.array(rois) .== i) .* Minc2.array(jac) )*voxel_volume)\")\nend","category":"page"},{"location":"#Graphic-examples,-using-Makie","page":"Introduction to Minc2.jl","title":"Graphic examples, using Makie","text":"","category":"section"},{"location":"#Show-MNI-ICBM152-template-contours-with-tissue-masks-overlays","page":"Introduction to Minc2.jl","title":"Show MNI-ICBM152 template contours with tissue masks overlays","text":"","category":"section"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"using CairoMakie\nusing Minc2\n\n# read T1w scan\nicbm=Minc2.read_volume(\"mni_icbm152_t1_tal_nlin_sym_09c.mnc\", store=Float64)\n# read label mask, represent it as array of bytes \nlab=Minc2.read_volume(\"mni_icbm152_cls_tal_nlin_sym_09c.mnc\", store=UInt8)\n\n\nfig = Figure()\ngc = fig[1, 1] = GridLayout()\n\nMinc2.draw_outline_with_labels(gc, icbm, lab, \n labels=Dict([1=>\"CSF\",2=>\"GM\",3=>\"WM\"]),\n nslices = 5)\n\nresize_to_layout!(fig)\n\nsave(\"mni_icbm152_segmentation.png\", fig, px_per_unit = 1)","category":"page"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"Will produce (Image: MNI-ICBM152)","category":"page"},{"location":"#Show-MNI-ICBM152-template-contours-with-GM-proability-map","page":"Introduction to Minc2.jl","title":"Show MNI-ICBM152 template contours with GM proability map","text":"","category":"section"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"using CairoMakie\nusing Minc2\n\n# read T1w scan\nanat=Minc2.read_volume(\"mni_icbm152_t1_tal_nlin_sym_09c.mnc\",store=Float64)\n# read field\ngm=Minc2.read_volume(\"mni_icbm152_gm_tal_nlin_sym_09c.mnc\",store=Float64)\n\nfig = Figure()\ngc = fig[1, 1] = GridLayout()\n\n# set background to transparent\nMinc2.array(gm)[Minc2.array(gm) .< 1e-6] .= NaN\n\nMinc2.draw_outline_with_heatmap(gc, anat, gm, \n heat_limits=(0.0,1.0),cmap=:turbo,\n nslices = 5)\n\nresize_to_layout!(fig)\n\nsave(\"mni_icbm152_gm.png\", fig, px_per_unit = 1) ","category":"page"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"Will produce (Image: MNI-ICBM152)","category":"page"},{"location":"#More-examples","page":"Introduction to Minc2.jl","title":"More examples","text":"","category":"section"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"See examples directory for more examples:","category":"page"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"bloor.jl - Apply Blooring kernel to minc volume, equivalent to mincbloor\ncopy.jl - Create a minc volume with the same dimensions as another one, copy voxels\ndraw_heatmap.jl - Show MNI-ICBM152 template contours with GM proability map, as above\ndraw_seg.jl - Show MNI-ICBM152 template contours with tissue masks overlays, as above\nlist_meta.jl - List all metadata stored with minc file, similar to mincheader\nmriview_dual.jl - Show two minc volumes side-by-side, interactively\nmriview.jl - Show minc volume, interactively\nmultilabel_overlap.jl - calculate voxel-wise generalized overlap coeffecient , method from http://dx.doi.org/10.1109/TMI.2006.880587\nresample_grid.jl - apply transformation to _grid file\nresample_itk.jl - resample nifti file with transformations produces by ANTS (multiple transformations can be applied in one go), equivalent to antsApplyTransforms\nresample.jl - apply transformation to minc volume, equivalent to mincresample\nxfm_to_jacobian.jl - calculate jacobian determinant field, for a given .xfm file\nmincinfo.jl - show information about mincfile(s) and store it in csv file, equivalent to mincinfo","category":"page"},{"location":"#Documentation-for-MINC","page":"Introduction to Minc2.jl","title":"Documentation for MINC","text":"","category":"section"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"Documentations for underlying libminc and minc tools is available at https://en.wikibooks.org/wiki/MINC","category":"page"}] +[{"location":"function_list/","page":"Alphabetical function list","title":"Alphabetical function list","text":"CurrentModule = Minc2\n\nDocTestSetup = quote\n using Minc2\nend","category":"page"},{"location":"function_list/#Index","page":"Alphabetical function list","title":"Index","text":"","category":"section"},{"location":"function_list/","page":"Alphabetical function list","title":"Alphabetical function list","text":"","category":"page"},{"location":"high_level/","page":"High level functions","title":"High level functions","text":"CurrentModule = Minc2\n\nDocTestSetup = quote\n using Minc2\nend","category":"page"},{"location":"high_level/#High-level-functions-for-operations-on-MRI-scans","page":"High level functions","title":"High level functions for operations on MRI scans","text":"","category":"section"},{"location":"high_level/#3D-Volume-information","page":"High level functions","title":"3D Volume information","text":"","category":"section"},{"location":"high_level/","page":"High level functions","title":"High level functions","text":"Minc2.voxel_to_world\nMinc2.world_to_voxel\nMinc2.array\nMinc2.history\n","category":"page"},{"location":"high_level/#Minc2.voxel_to_world","page":"High level functions","title":"Minc2.voxel_to_world","text":"voxel_to_world(grid::GridTransform)\n\nExtract voxel to world affine transform from a GridTransform\n\ngrid - GridTransform\n\n\n\n\n\nvoxel_to_world(grid::InverseGridTransform)\n\nExtract voxel to world affine transform from a InverseGridTransform\n\ngrid - InverseGridTransform\n\n\n\n\n\nvoxel_to_world(hdr::MincHeader)::AffineTransform{Float64}\n\nGive AffineTransform for world to voxel transformation based on header\n\n\n\n\n\nvoxel_to_world(h::VolumeHandle,ijk::Vector{Float64})::Vector{Float64}\n\nConvert contignuous 0-based voxel indexes (I,J,K) to world coordinates (X,Y,Z) 0-based\n\n\n\n\n\nvoxel_to_world(vol::Volume3D)\n\nExtract voxel to world affine transform from a Volume3D\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.world_to_voxel","page":"High level functions","title":"Minc2.world_to_voxel","text":"world_to_voxel(grid::GridTransform)\n\nExtract world to voxel affine transform from a GridTransform\n\ngrid - GridTransform\n\n\n\n\n\nworld_to_voxel(grid::InverseGridTransform)\n\nExtract world to voxel affine transform from a InverseGridTransform\n\ngrid - InverseGridTransform\n\n\n\n\n\nworld_to_voxel(h::VolumeHandle, xyz::Vector{Float64})::Vector{Float64}\n\nConvert world coordinates (X,Y,Z) to contignuous voxel indexes (I,J,K) 0-based\n\n\n\n\n\nworld_to_voxel(hdr::MincHeader)::AffineTransform{Float64}\n\nGive AffineTransform for voxel to world transformation\n\n\n\n\n\nworld_to_voxel(vol::Volume3D)\n\nExtract world to voxel affine transform from a Volume3D\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.array","page":"High level functions","title":"Minc2.array","text":"array(grid::GridTransform)\n\nExtract underlying plain array\n\ngrid - GridTransform\n\n\n\n\n\narray(grid::InverseGridTransform)\n\nExtract underlying plain array\n\ngrid - InverseGridTransform\n\n\n\n\n\narray(vol::Volume3D)\n\nExtract underlying plain array\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.history","page":"High level functions","title":"Minc2.history","text":"history(vol::Volume3D)\n\nExtract history metadata\n\n\n\n\n\n","category":"function"},{"location":"high_level/#File-IO-functions","page":"High level functions","title":"File IO functions","text":"","category":"section"},{"location":"high_level/#Loading-3D-volumes","page":"High level functions","title":"Loading 3D volumes","text":"","category":"section"},{"location":"high_level/","page":"High level functions","title":"High level functions","text":"Minc2.read_volume\nMinc2.read_nifti_volume","category":"page"},{"location":"high_level/#Minc2.read_volume","page":"High level functions","title":"Minc2.read_volume","text":"read_volume(fn::String; store::Type{T}=Float64)::Volume3D{T}\n\nRead Volume3D from minc file\n\nfn - filename\nstore - underlying array type\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.read_nifti_volume","page":"High level functions","title":"Minc2.read_nifti_volume","text":"read_nifti_volume(fn::AbstractString; store::Type{T}=Float64)::Volume3D{T}\n\nRead Volume3D from .nii or .nii.gz file\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Saving-3D-volumes","page":"High level functions","title":"Saving 3D volumes","text":"","category":"section"},{"location":"high_level/","page":"High level functions","title":"High level functions","text":"Minc2.save_volume\nMinc2.save_nifti_volume","category":"page"},{"location":"high_level/#Minc2.save_volume","page":"High level functions","title":"Minc2.save_volume","text":"save_volume(fn::AbstractString, \n vol::Volume3D{T,N}; \n store::Type{S}=Float32,\n history=nothing)\n\nSave Volume3D to minc file\n\nfn - filename\nvol - Volume3D to save\nstore - underlying MINC data type, to be used for storage\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.save_nifti_volume","page":"High level functions","title":"Minc2.save_nifti_volume","text":"save_nifti_volume(fn::AbstractString, vol::Volume3D{T}; \n store::Type{S}=Float32, history=nothing)\n\nSave Volume3D into .nii or .nii.gz file\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Loading-transformations","page":"High level functions","title":"Loading transformations","text":"","category":"section"},{"location":"high_level/","page":"High level functions","title":"High level functions","text":"Minc2.read_transforms\nMinc2.read_itk_nifti_transform\nMinc2.read_ants_transform","category":"page"},{"location":"high_level/#Minc2.read_transforms","page":"High level functions","title":"Minc2.read_transforms","text":"read_transforms(fname::String)::Vector{AnyTransform}\n\nRead transformations from .xfm file fname\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.read_itk_nifti_transform","page":"High level functions","title":"Minc2.read_itk_nifti_transform","text":"read_itk_nifti_transform(fn::AbstractString;\n store::Type{T}=Float32)::Minc2.GridTransform{Float64,T}\n\nRead ANTs style warp transform\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.read_ants_transform","page":"High level functions","title":"Minc2.read_ants_transform","text":"read_ants_transform(fn::AbstractString; store::Type{T}=Float32)::Minc2.AnyTransform\n\nRead .txt and .nii(.nii.gz) transforms produces by ANTs\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Saving-transformations","page":"High level functions","title":"Saving transformations","text":"","category":"section"},{"location":"high_level/","page":"High level functions","title":"High level functions","text":"Minc2.save_transforms\nMinc2.save_itk_nifti_transform\nMinc2.save_itk_txt_transform","category":"page"},{"location":"high_level/#Minc2.save_transforms","page":"High level functions","title":"Minc2.save_transforms","text":"save_transforms(fname::String, \n xfm::Union{Vector{XFM}, XFM};\n grid_store::Type{T}=Float32 ) where {T, XFM<:AnyTransform}\n\nSave transformations into .xfm file, \n\nArguments\n\nfname: output file name\nxfm: vector of transformations to save, or a single transformation\ngrid_store: type of storage for grid files (default: Float32)\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.save_itk_nifti_transform","page":"High level functions","title":"Minc2.save_itk_nifti_transform","text":"save_itk_nifti_transform(fn::AbstractString,\n xfm::Minc2.GridTransform{Float64,T}; store::Type{S}=Float32)\n\nWrite ANTs style warp transform\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.save_itk_txt_transform","page":"High level functions","title":"Minc2.save_itk_txt_transform","text":"save_itk_txt_transform(fn::AbstractString,\n xfm::Minc2.AffineTransform{Float64})\n\nWrite affine transform in ITK .txt format\n\n\n\n\n\n","category":"function"},{"location":"high_level/#3D-Volume-creation","page":"High level functions","title":"3D Volume creation","text":"","category":"section"},{"location":"high_level/","page":"High level functions","title":"High level functions","text":"Minc2.Volume3D\nMinc2.empty_volume_like\nMinc2.full_volume_like","category":"page"},{"location":"high_level/#Minc2.Volume3D","page":"High level functions","title":"Minc2.Volume3D","text":"Volume3D{T,N}\n\nAn abstract 3D volume, could be vector field or volume with time dimension\n\n\n\n\n\n","category":"type"},{"location":"high_level/#Minc2.empty_volume_like","page":"High level functions","title":"Minc2.empty_volume_like","text":"empty_volume_like(\n fn::String; \n store::Type{T}=Float64, history=nothing)::Volume3D{T}\n\nCreate an empty Volume3D\n\nfn - filename of a minc file that is used for sampling information\nstore - underlying array type\n\n\n\n\n\nempty_volume_like(\n vol::Volume3D{T1,N}; \n store::Type{T}=Float64, \n history=nothing)\n\nCreate an empty Volume3D\n\nvol - Volume3D that is used for sampling information\nstore - underlying array type\nhistory - minc history\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.full_volume_like","page":"High level functions","title":"Minc2.full_volume_like","text":"full_volume_like(\n fn::String,\n fill::T=zero(T); \n store::Type{T}=Float64, history=nothing)::Volume3D{T}\n\nCreate an empty Volume3D\n\nfn - filename of a minc file that is used for sampling information\nstore - underlying array type\n\n\n\n\n\nfull_volume_like(\n vol::Volume3D{T1,N}; \n store::Type{T}=Float64, \n history=nothing)\n\nCreate an empty Volume3D\n\nvol - Volume3D that is used for sampling information\nstore - underlying array type\nhistory - minc history\n\n\n\n\n\n","category":"function"},{"location":"high_level/#3D-Volume-manipulations","page":"High level functions","title":"3D Volume manipulations","text":"","category":"section"},{"location":"high_level/","page":"High level functions","title":"High level functions","text":"Minc2.resample_volume\nMinc2.resample_volume!\nMinc2.resample_grid\nMinc2.resample_grid!\nMinc2.crop_volume","category":"page"},{"location":"high_level/#Minc2.resample_volume","page":"High level functions","title":"Minc2.resample_volume","text":"resample_volume(\n in_vol::Volume3D{T,3};\n like::Union{Volume3D{O,3},Nothing}=nothing,\n tfm::Union{Vector{XFM},XFM,Nothing}=nothing, \n itfm::Union{Vector{XFM},XFM,Nothing}=nothing, \n interp::I=nothing, \n fill=0.0,\n order=1,\n ftol=1.0/80,\n max_iter=10)::Volume3D\n\nResample Volume3D using transformation \n\nin_vol - input Volume3D\nlike - Volume3D that is used for sampling information\nitfm - inverse of the transformation to apply (i.e from output to input)\ntfm - transformation to apply (i.e from output to input) (instead of itfm)\ninterp - interpolation method\nfill - fill value\nftol - tolerance, for inverse transformations\nmax_iter - maximum number of iterations, for inverse transformations\n\nEquivalent to mincresample minc command\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.resample_volume!","page":"High level functions","title":"Minc2.resample_volume!","text":"resample_volume!(in_vol::AbstractArray{T,3}, \n out_vol::AbstractArray{T,3}, \n v2w::AffineTransform{C}, \n w2v::AffineTransform{C}, \n itfm::Union{Vector{XFM},XFM};\n interp::I=BSpline(Quadratic(Line(OnCell()))),\n fill=0.0,\n ftol=1.0/80,\n max_iter=10)\n\nResample 3D array using transformation \n\nin_vol - input 3D array\nout_vol - output 3D array\nv2w - voxel to world affine transform in the output array\nw2v - world to voxel affine transform in the input array\nitfm - inverse of the transformation to apply (i.e from output to input)\ninterp - interpolation method\nfill - fill value\nftol - tolerance, for inverse transformations\nmax_iter - maximum number of iterations, for inverse transformations\n\n\n\n\n\nresample_volume!(\n in_vol::Volume3D{T,3}, \n out_vol::Volume3D{O,3}; \n tfm::Union{Vector{XFM},XFM,Nothing}=nothing, \n itfm::Union{Vector{XFM},XFM,Nothing}=nothing, \n interp::I=nothing, \n fill=0.0, \n order=nothing,\n ftol=1.0/80,\n max_iter=10)::Volume3D{O,3}\n\nResample Volume3D using transformation \n\nin_vol - input Volume3D\nout_vol - output Volume3D\nitfm - inverse of the transformation to apply (i.e from output to input)\ntfm - transformation to apply (i.e from output to input) (instead of itfm)\ninterp - interpolation method\nfill - fill value\nftol - tolerance, for inverse transformations\nmax_iter - maximum number of iterations, for inverse transformations\n\nEquivalent to mincresample minc command\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.resample_grid","page":"High level functions","title":"Minc2.resample_grid","text":"resample_grid(\n in_grid::Volume3D{T,4}, \n itfm::Union{Vector{XFM}, XFM}; \n like::Union{Nothing,Volume3D{L,4}}=nothing)::Volume3D{T,4}\n\nResample Volume3D that contain 4D array, using transformation, assume 1st dimension is non spatial\n\nin_grid - input Volume3D with 4D array describing vector field\nitfm - inverse of the transformation to apply (i.e from output to input)\nlike - Volume3D that is used for sampling information\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.resample_grid!","page":"High level functions","title":"Minc2.resample_grid!","text":"resample_grid!(\n in_grid::Volume3D{T,4},\n out_grid::Volume3D{T,4},\n itfm::Union{Vector{XFM}, XFM}=nothing)::Volume3D{T,4}\n\nResample Volume3D that contain 4D array, using transformation, assume 1st dimension is non spatial\n\nin_grid - input Volume3D with 4D array describing vector field\nout_grid - output Volume3D with 4D array describing vector field\nitfm - inverse of the transformation to apply (i.e from output to input)\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.crop_volume","page":"High level functions","title":"Minc2.crop_volume","text":"crop_volume(in_vol::Volume3D{T,N},crop;\n fill_val::T=zero(T))::Volume3D{T,N}\n\nCrop (or pad) a volume\n\nin_vol - input Volume3D\ncrop - crop specification for each direction, e.g. [(10,10),(20,20),(5,10)] , negative values mean padding\n\n\n\n\n\n","category":"function"},{"location":"high_level/#3D-Volume-and-geometrical-transformation-link","page":"High level functions","title":"3D Volume and geometrical transformation link","text":"","category":"section"},{"location":"high_level/","page":"High level functions","title":"High level functions","text":"Minc2.calculate_jacobian\nMinc2.calculate_jacobian!\nMinc2.GridTransform\nMinc2.InverseGridTransform\nMinc2.tfm_to_grid\nMinc2.normalize_tfm","category":"page"},{"location":"high_level/#Minc2.calculate_jacobian","page":"High level functions","title":"Minc2.calculate_jacobian","text":"calculate_jacobian(\n tfm::Union{Vector{XFM},XFM};\n like::Volume3D{T,3}; \n interp::I=BSpline(Quadratic(Line(OnCell()))),\n ftol=1.0/80,\n max_iter=10)::Volume3D{T,3}\n\nCalculate dense jacobian determinant field for an arbitrary transformation\n\ntfm - transformation to use\nout_vol - output Volume3D\ninterp - interpolation method\nftol - tolerance, for inverse transformations\nmax_iter - maximum number of iterations, for inverse transformations\n\nRoughly equivalent to mincblob minc command\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.calculate_jacobian!","page":"High level functions","title":"Minc2.calculate_jacobian!","text":"calculate_jacobian!(\n tfm::Union{Vector{XFM},XFM},\n out_vol::AbstractArray{T,3},\n out_v2w::AffineTransform{C};\n interp::I=BSpline(Quadratic(Line(OnCell()))),\n ftol=1.0/80,\n max_iter=10)\n\nCalculate dense jacobian determinant field for an arbitrary transformation\n\ntfm - transformation to use\nout_vol - output 3D array\nout_v2w - voxel to world affine transform in the output array\ninterp - interpolation method\nftol - tolerance, for inverse transformations\nmax_iter - maximum number of iterations, for inverse transformations\n\nRoughly equivalent to mincblob minc command\n\n\n\n\n\ncalculate_jacobian!(\n tfm::Union{Vector{XFM},XFM}, \n out_vol::Volume3D{T,3}; \n interp::I=BSpline(Quadratic(Line(OnCell()))),\n ftol=1.0/80,\n max_iter=10)::Volume3D{T,3}\n\nCalculate dense jacobian determinant field for an arbitrary transformation\n\ntfm - transformation to use\nout_vol - output Volume3D\ninterp - interpolation method\nftol - tolerance, for inverse transformations\nmax_iter - maximum number of iterations, for inverse transformations\n\nRoughly equivalent to mincblob minc command\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.tfm_to_grid","page":"High level functions","title":"Minc2.tfm_to_grid","text":"tfm_to_grid(\n tfm::Union{Vector{XFM}, XFM},\n ref::G;\n store::Type{T}=Float64,ftol=1.0/80,max_iter=10)::Volume3D{T,4}\n\nConvert arbitrary transformation into Volume3D with 4D array containing vector field\n\ntfm - transformation to use\nv2w - voxel to world affine transform in the output array\nftol - tolerance, for inverse transformations\nmax_iter - maximum number of iterations, for inverse transformations\n\n\n\n\n\n","category":"function"},{"location":"high_level/#Minc2.normalize_tfm","page":"High level functions","title":"Minc2.normalize_tfm","text":"normalize_tfm(tfm::Union{Vector{XFM}, XFM},\n ref::G;\n store::Type{T}=Float64,ftol=1.0/80,max_iter=10)::GridTransform{Float64,T}\n\nConvert arbitrary transformation into a single GridTransform\n\ntfm - transformation to use\nref - GridTransform that is used for sampling information\nstore - underlying array type\nftol - tolerance, for inverse transformations\nmax_iter - maximum number of iterations, for inverse transformations\n\n\n\n\n\nnormalize_tfm(tfm::Union{Vector{XFM}, XFM},\n ref::G;\n store::Type{T}=Float64,ftol=1.0/80,max_iter=10)::GridTransform{Float64,T}\n\nConvert arbitrary transformation into a single GridTransform\n\ntfm - transformation to use\nref - Volume3D that is used for sampling information\nstore - underlying array type\nftol - tolerance, for inverse transformations\nmax_iter - maximum number of iterations, for inverse transformations\n\n\n\n\n\n","category":"function"},{"location":"geo/","page":"Gemetric transformation functions","title":"Gemetric transformation functions","text":"CurrentModule = Minc2\n\nDocTestSetup = quote\n using Minc2\nend","category":"page"},{"location":"geo/#Functions-for-gemetric-transformations","page":"Gemetric transformation functions","title":"Functions for gemetric transformations","text":"","category":"section"},{"location":"geo/","page":"Gemetric transformation functions","title":"Gemetric transformation functions","text":"Modules = [Minc2]\nPages = [\n \"geo_transform.jl\",\n]\nOrder = [:macro, :function, :type, :constant, ]","category":"page"},{"location":"geo/#Base.length-Tuple{Minc2.AnyTransform}","page":"Gemetric transformation functions","title":"Base.length","text":"Base.length(tr::AnyTransform)\n\nLength of concatenated transform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Base.show-Union{Tuple{I}, Tuple{F}, Tuple{T}, Tuple{IO, Minc2.GridTransform{T, F, I}}} where {T, F, I}","page":"Gemetric transformation functions","title":"Base.show","text":"Base.show(io::IO, z::GridTransform{T,F,I})\n\nPrint summary information about grid transform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Base.show-Union{Tuple{I}, Tuple{F}, Tuple{T}, Tuple{IO, Minc2.InverseGridTransform{T, F, I}}} where {T, F, I}","page":"Gemetric transformation functions","title":"Base.show","text":"Base.show(io::IO, z::InverseGridTransform{T,F,I})\n\nPrint summary information about inverse grid transform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.array-Tuple{Minc2.GridTransform}","page":"Gemetric transformation functions","title":"Minc2.array","text":"array(grid::GridTransform)\n\nExtract underlying plain array\n\ngrid - GridTransform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.array-Tuple{Minc2.InverseGridTransform}","page":"Gemetric transformation functions","title":"Minc2.array","text":"array(grid::InverseGridTransform)\n\nExtract underlying plain array\n\ngrid - InverseGridTransform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.decompose-Tuple{Any, Any}","page":"Gemetric transformation functions","title":"Minc2.decompose","text":"decompose(rot, shift)\n\nDecompose affine transform specified as rotation matrix ans shift vector into three components start, step, direction cosines\n\nrot - rotation matrix (3x3)\nshift - shift vector (3)\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.decompose-Union{Tuple{Matrix{T}}, Tuple{T}} where T","page":"Gemetric transformation functions","title":"Minc2.decompose","text":"decompose(tfm::Matrix{T})\n\nDecompose affine transform into three components start, step, direction cosines\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.decompose-Union{Tuple{Minc2.AffineTransform{T}}, Tuple{T}} where T","page":"Gemetric transformation functions","title":"Minc2.decompose","text":"decompose(tfm::AffineTransform{T})\n\nDecompose affine transform into three components start, step, direction cosines\n\ntfm - affine transform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.interpolate_field-Union{Tuple{I}, Tuple{T}, Tuple{Minc2.AffineTransform{T}, I, StaticArraysCore.SVector{3, T}}} where {T, I<:Interpolations.Extrapolation}","page":"Gemetric transformation functions","title":"Minc2.interpolate_field","text":"interpolate_field(\n v2w::AffineTransform{T},\n itp_vector_field::I, \n p::SVector{3,T} )::SVector{3,T}\n\nInternal support function\n\nv2w - voxel to world affine transform\nitp_vector_field - vector field\np - point to transform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.inv-Tuple{Minc2.IdentityTransform}","page":"Gemetric transformation functions","title":"Minc2.inv","text":"inv(::IdentityTransform)::IdentityTransform\n\nInvert IdentityTransform transform, does nothing\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.inv-Union{Tuple{Minc2.AffineTransform{T}}, Tuple{T}} where T","page":"Gemetric transformation functions","title":"Minc2.inv","text":"inv(t::AffineTransform{T})::AffineTransform{T}\n\nInvert AffineTransform transform\n\nt - AffineTransform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.inv-Union{Tuple{Minc2.GridTransform{T, F, VF}}, Tuple{VF}, Tuple{F}, Tuple{T}} where {T, F, VF}","page":"Gemetric transformation functions","title":"Minc2.inv","text":"inv(t::GridTransform{T,F,VF})::InverseGridTransform{T,F,VF}\n\nInvert GridTransform transform\n\nt - GridTransform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.inv-Union{Tuple{Minc2.InverseGridTransform{T, F, VF}}, Tuple{VF}, Tuple{F}, Tuple{T}} where {T, F, VF}","page":"Gemetric transformation functions","title":"Minc2.inv","text":"inv(t::InverseGridTransform{T,F,VF})::GridTransform{T,F,VF}\n\nInvert InverseGridTransform transform\n\nt - InverseGridTransform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.inv-Union{Tuple{Vector{T}}, Tuple{T}} where T<:Minc2.AnyTransform","page":"Gemetric transformation functions","title":"Minc2.inv","text":"inv(t::Vector{T})::Vector{AnyTransform}\n\nInvert concatenated transform\n\nt - concatenated transform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.transform_point-Union{Tuple{F}, Tuple{T}, Tuple{Minc2.GridTransform{T, F, I} where I, StaticArraysCore.SVector{3, T}}} where {T, F}","page":"Gemetric transformation functions","title":"Minc2.transform_point","text":"transform_point(\n tfm::GridTransform{T,F}, p::SVector{3,T};\n _whatever...)::SVector{3,T} where {T,F}\n\nApply forward grid transform to a point\n\ntfm - grid transform\np - point to transform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.transform_point-Union{Tuple{F}, Tuple{T}, Tuple{Minc2.InverseGridTransform{T, F, VF} where VF, StaticArraysCore.SVector{3, T}}} where {T, F}","page":"Gemetric transformation functions","title":"Minc2.transform_point","text":"transform_point(\n tfm::AffineTransform{T}, \n p::CartesianIndex{3};\n _whatever...)::SVector{3,T}\n\nApply inverse grid transform reimplements algorithm from MNIformats/gridtransforms.c:gridinversetransform_point\n\ntfm - affine transform\np - point to transform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.transform_point-Union{Tuple{T}, Tuple{Minc2.AffineTransform{T}, CartesianIndex{3}}} where T","page":"Gemetric transformation functions","title":"Minc2.transform_point","text":"transform_point(\n tfm::AffineTransform{T}, \n p::CartesianIndex{3};\n _whatever...)::SVector{3,T}\n\nApply affine transform to CartesianIndices\n\ntfm - affine transform\np - point to transform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.transform_point-Union{Tuple{T}, Tuple{Minc2.AffineTransform{T}, StaticArraysCore.SVector{3, T}}} where T","page":"Gemetric transformation functions","title":"Minc2.transform_point","text":"transform_point(\n tfm::AffineTransform{T}, \n p::SVector{3,T};\n _whatever...)::SVector{3,T}\n\nApply affine transform to a point\n\ntfm - affine transform\np - point to transform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.transform_point-Union{Tuple{T}, Tuple{Minc2.IdentityTransform, StaticArraysCore.SVector{3, T}}} where T","page":"Gemetric transformation functions","title":"Minc2.transform_point","text":"transform_point(tfm::IdentityTransform, \n p::SVector{3,T};\n _whatever...)\n\ntfm - IdentityTransform\np - point to transform\n\nApply identity transform to a point (returns same point)\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.transform_point-Union{Tuple{T}, Tuple{XFM}, Tuple{Vector{XFM}, StaticArraysCore.SVector{3, T}}} where {XFM<:Minc2.AnyTransform, T}","page":"Gemetric transformation functions","title":"Minc2.transform_point","text":"transform_point(\n tfm::Vector{XFM},\n p::SVector{3,T};\n max_iter::Int=10,\n ftol::Float64=1.0/80)::SVector{3,T}\n\nApply concatenated transform to a point\n\ntfm - concatenated transform\np - point to transform\nmax_iter - maximum number of iterations for inverse transform\nftol - tolerance for inverse transform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.voxel_to_world-Tuple{Minc2.GridTransform}","page":"Gemetric transformation functions","title":"Minc2.voxel_to_world","text":"voxel_to_world(grid::GridTransform)\n\nExtract voxel to world affine transform from a GridTransform\n\ngrid - GridTransform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.voxel_to_world-Tuple{Minc2.InverseGridTransform}","page":"Gemetric transformation functions","title":"Minc2.voxel_to_world","text":"voxel_to_world(grid::InverseGridTransform)\n\nExtract voxel to world affine transform from a InverseGridTransform\n\ngrid - InverseGridTransform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.world_to_voxel-Tuple{Minc2.GridTransform}","page":"Gemetric transformation functions","title":"Minc2.world_to_voxel","text":"world_to_voxel(grid::GridTransform)\n\nExtract world to voxel affine transform from a GridTransform\n\ngrid - GridTransform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.world_to_voxel-Tuple{Minc2.InverseGridTransform}","page":"Gemetric transformation functions","title":"Minc2.world_to_voxel","text":"world_to_voxel(grid::InverseGridTransform)\n\nExtract world to voxel affine transform from a InverseGridTransform\n\ngrid - InverseGridTransform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.AffineTransform","page":"Gemetric transformation functions","title":"Minc2.AffineTransform","text":"AffineTransform{T}\n\nAffine transform, described by rotation matrix and shift vector\n\n\n\n\n\n","category":"type"},{"location":"geo/#Minc2.AffineTransform-Tuple{Any, Any}","page":"Gemetric transformation functions","title":"Minc2.AffineTransform","text":"AffineTransform(rot, shift) Create affine transform from rotation and shift\n\nrot - rotation matrix-like (3x3)\nshift - shift vector-like (3)\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.AffineTransform-Tuple{Any}","page":"Gemetric transformation functions","title":"Minc2.AffineTransform","text":"AffineTransform(mat) Create affine transform from a matrix-like object\n\nmat - matrix (4x4 or 3x4)\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.AnyTransform","page":"Gemetric transformation functions","title":"Minc2.AnyTransform","text":"AnyTransform()\n\nAny 3D Geometrical transform, abstract type\n\n\n\n\n\n","category":"type"},{"location":"geo/#Minc2.GeoTransforms","page":"Gemetric transformation functions","title":"Minc2.GeoTransforms","text":"GeoTransforms=Vector{AnyTransform}\n\nConcatenated transforms\n\n\n\n\n\n","category":"type"},{"location":"geo/#Minc2.GridTransform","page":"Gemetric transformation functions","title":"Minc2.GridTransform","text":"GridTransform{T,F,I}\n\nDense vector field transform (grid transform)\n\n\n\n\n\n","category":"type"},{"location":"geo/#Minc2.GridTransform-Union{Tuple{F}, Tuple{T}, Tuple{Minc2.AffineTransform{T}, Array{F, 4}}} where {T, F}","page":"Gemetric transformation functions","title":"Minc2.GridTransform","text":"GridTransform(\n voxel_to_world::AffineTransform{T},\n vector_field::Array{F, 4})\n\nConstruct GridTransform from voxel to world transform and a vector field\n\nvoxel_to_world - voxel to world affine transform\nvector_field - vector field\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.GridTransform-Union{Tuple{}, Tuple{Type{T}}, Tuple{F}, Tuple{T}, Tuple{Type{T}, Type{F}}} where {T, F}","page":"Gemetric transformation functions","title":"Minc2.GridTransform","text":"GridTransform(::Type{T}=Float64,::Type{F}=Float64)\n\nConstruct empty GridTransform, which should generate identity transform\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.IdentityTransform","page":"Gemetric transformation functions","title":"Minc2.IdentityTransform","text":"IdentityTransform()\n\nIdentity transform, does nothing\n\n\n\n\n\n","category":"type"},{"location":"geo/#Minc2.InverseGridTransform","page":"Gemetric transformation functions","title":"Minc2.InverseGridTransform","text":"InverseGridTransform{T,F,VF}\n\nDense vector field transform (GridTransform) used in inverse\n\n\n\n\n\n","category":"type"},{"location":"geo/#Minc2.InverseGridTransform-Union{Tuple{F}, Tuple{T}, Tuple{Minc2.AffineTransform{T}, Array{F, 4}}} where {T, F}","page":"Gemetric transformation functions","title":"Minc2.InverseGridTransform","text":"InverseGridTransform(\n voxel_to_world::AffineTransform{T},\n vector_field::Array{F, 4})\n\nConstruct InverseGridTransform from voxel to world transform and a vector field\n\nvoxel_to_world - voxel to world affine transform\nvector_field - vector field\n\n\n\n\n\n","category":"method"},{"location":"geo/#Minc2.InverseGridTransform-Union{Tuple{}, Tuple{Type{T}}, Tuple{F}, Tuple{T}, Tuple{Type{T}, Type{F}}} where {T, F}","page":"Gemetric transformation functions","title":"Minc2.InverseGridTransform","text":"InverseGridTransform(::Type{T}=Float64,::Type{F}=Float64)\n\nConstruct InverseGridTransform empty transform\n\n\n\n\n\n","category":"method"},{"location":"low_level/","page":"Low level functions","title":"Low level functions","text":"CurrentModule = Minc2\n\nDocTestSetup = quote\n using Minc2\nend","category":"page"},{"location":"low_level/#Low-level-functions-for-IO-on-.mnc-and-.xfm-files","page":"Low level functions","title":"Low level functions for IO on .mnc and .xfm files","text":"","category":"section"},{"location":"low_level/","page":"Low level functions","title":"Low level functions","text":"Modules = [Minc2]\nPages = [\n \"minc2_io.jl\",\n \"xfm_io.jl\",\n]\nOrder = [:macro, :function, :type, :constant, ]","category":"page"},{"location":"low_level/#Minc2.@minc2_check-Tuple{Any}","page":"Low level functions","title":"Minc2.@minc2_check","text":"minc2_check( ex )\n\nMacro to verify the return code\n\n\n\n\n\n","category":"macro"},{"location":"low_level/#Minc2._hdr_convert!-Tuple{Minc2.MincHeader, Any}","page":"Low level functions","title":"Minc2._hdr_convert!","text":"_hdr_convert!(hdr::MincHeader,dd)::MincHeader\n\ninternal function\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.attributes-Tuple{Minc2.VolumeHandle, String}","page":"Low level functions","title":"Minc2.attributes","text":"attributes(h::VolumeHandle, g::String)\n\nList attributes defined inside given group\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.close_minc_file-Tuple{Minc2.VolumeHandle}","page":"Low level functions","title":"Minc2.close_minc_file","text":"close_minc_file(h::VolumeHandle)\n\nClose currently open minc file, commit data on disk\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.copy_minc_metadata-Tuple{Minc2.VolumeHandle, Minc2.VolumeHandle}","page":"Low level functions","title":"Minc2.copy_minc_metadata","text":"copy_minc_metadata(i::VolumeHandle, o::VolumeHandle)\n\nCopy metadata from one file to another\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.create_header_from_v2w-Union{Tuple{T}, Tuple{Any, Minc2.AffineTransform{T}}} where T","page":"Low level functions","title":"Minc2.create_header_from_v2w","text":"create_header_from_v2w(\n sz, t::AffineTransform{T};\n vector_dim::Bool=false, \n time_step::Union{Float64,Nothing}=nothing,\n time_start::Union{Float64,Nothing}=nothing)::MincHeader\n\nInternal: Generate header from the voxel to world transform and volume size\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.create_minc_file-Tuple{Minc2.VolumeHandle, AbstractString}","page":"Low level functions","title":"Minc2.create_minc_file","text":"create_minc_file(h::VolumeHandle, path::AbstractString)\n\nCreate empty minc file on disk, structure need to be defined in advance\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.define_minc_file-Union{Tuple{Minc2.MincHeader}, Tuple{Repr}, Tuple{Store}, Tuple{Minc2.MincHeader, Type{Store}}, Tuple{Minc2.MincHeader, Type{Store}, Type{Repr}}} where {Store, Repr}","page":"Low level functions","title":"Minc2.define_minc_file","text":"define_minc_file(hdr::MincHeader,::Type{Store}=Float32,::Type{Repr}=Store)\n\nDefine new minc file structure, return handle\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.empty_like_minc_volume_raw-Union{Tuple{Minc2.VolumeHandle}, Tuple{T}, Tuple{Minc2.VolumeHandle, Type{T}}} where T<:Number","page":"Low level functions","title":"Minc2.empty_like_minc_volume_raw","text":"empty_like_minc_volume_raw( h::VolumeHandle,\n ::Type{T}=Float32 )::Tuple{Array{T}, Minc2.MincHeader}\n\nAllocate empty volume using handle return volume, storage header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.empty_like_minc_volume_raw-Union{Tuple{String}, Tuple{T}, Tuple{String, Type{T}}} where T<:Number","page":"Low level functions","title":"Minc2.empty_like_minc_volume_raw","text":"empty_like_minc_volume_raw(path::String, ::Type{T}=Float32 )::\n Tuple{Array{T}, Minc2.MincHeader}\n\nCreate empty volume similar to existing file return volume, representation header,storage header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.empty_like_minc_volume_std-Union{Tuple{Minc2.VolumeHandle}, Tuple{T}, Tuple{Minc2.VolumeHandle, Type{T}}} where T<:Number","page":"Low level functions","title":"Minc2.empty_like_minc_volume_std","text":"empty_like_minc_volume_std(h::VolumeHandle, \n ::Type{T}=Float32 )::Tuple{Array{T}, Minc2.MincHeader, Minc2.MincHeader}\n\nRead the actual volume using handle return volume, representation header,storage header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.empty_like_minc_volume_std-Union{Tuple{String}, Tuple{T}, Tuple{String, Type{T}}} where T<:Number","page":"Low level functions","title":"Minc2.empty_like_minc_volume_std","text":"empty_like_minc_volume_std(path::String, \n ::Type{T}=Float32 )::Tuple{Array{T}, Minc2.MincHeader, Minc2.MincHeader}\n\nallocate empty volume using path as a reference return volume, representation header,storage header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.empty_like_minc_volume_std_history-Union{Tuple{String}, Tuple{T}, Tuple{String, Type{T}}} where T<:Number","page":"Low level functions","title":"Minc2.empty_like_minc_volume_std_history","text":"empty_like_minc_volume_std_history(path::String, ::Type{T}=Float32 )\n\nallocate empty volume using path return volume, representation header,storage header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.get_attribute-Tuple{Minc2.VolumeHandle, String, String}","page":"Low level functions","title":"Minc2.get_attribute","text":"get_attribute(h::VolumeHandle,g::String,a::String; default=missing)\n\nConvenience function for reading specific attribute, return default value if not found also convert Array into the first value if it's a one-length array\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.groups-Tuple{Minc2.VolumeHandle}","page":"Low level functions","title":"Minc2.groups","text":"groups(h::VolumeHandle)\n\nList groups defined in minc2 file\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.minc2_load_and_convert_complete_volume-Union{Tuple{Tout}, Tuple{Tin}, Tuple{Minc2.VolumeHandle, Array{Tin, N} where N, Type{Tout}}} where {Tin<:AbstractFloat, Tout<:Integer}","page":"Low level functions","title":"Minc2.minc2_load_and_convert_complete_volume","text":"Internal function that makes sure types are compatible\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.minc2_load_and_convert_complete_volume-Union{Tuple{Tout}, Tuple{Tin}, Tuple{Minc2.VolumeHandle, Array{Tin, N} where N, Type{Tout}}} where {Tin<:Number, Tout<:Number}","page":"Low level functions","title":"Minc2.minc2_load_and_convert_complete_volume","text":"Internal function that makes shure types are compatible\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.minc2_load_and_convert_complete_volume-Union{Tuple{T}, Tuple{Minc2.VolumeHandle, Array{T, N} where N, Type{T}}} where T","page":"Low level functions","title":"Minc2.minc2_load_and_convert_complete_volume","text":"Internal function that makes shure types are compatible\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.ndim-Tuple{Minc2.VolumeHandle}","page":"Low level functions","title":"Minc2.ndim","text":"ndim(h::VolumeHandle)::Int\n\nQuery number of dimensions in the minc file\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.open_minc_file-Tuple{String}","page":"Low level functions","title":"Minc2.open_minc_file","text":"open_minc_file(fname::String)::VolumeHandle\n\nOpen minc file, return handle\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.read_attribute-Tuple{Minc2.VolumeHandle, String, String}","page":"Low level functions","title":"Minc2.read_attribute","text":"read_attribute(h::VolumeHandle, \n group::String,\n attribute::String)::Union{String, AbstractVector, Nothing}\n\nRead minc2 header attribute :param group: attribute group name :param attribute: attribute name :return:\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.read_history-Tuple{Minc2.VolumeHandle}","page":"Low level functions","title":"Minc2.read_history","text":"read_history(i::VolumeHandle)::Union{String, Nothing}\n\nReturn history string\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.read_minc_volume_raw-Union{Tuple{Minc2.VolumeHandle}, Tuple{T}, Tuple{Minc2.VolumeHandle, Type{T}}} where T<:Number","page":"Low level functions","title":"Minc2.read_minc_volume_raw","text":"read_minc_volume_raw(h::VolumeHandle, \n ::Type{T}=Float32 )::Tuple{Array{T}, Minc2.MincHeader}\n\nRead the actual volume using handle return volume, storage header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.read_minc_volume_raw-Union{Tuple{String}, Tuple{T}, Tuple{String, Type{T}}} where T<:Number","page":"Low level functions","title":"Minc2.read_minc_volume_raw","text":"read_minc_volume_raw(path::String, ::Type{T}=Float32 )::\n Tuple{Array{T}, Minc2.MincHeader}\n\nRead the actual volume using path return volume, representation header,storage header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.read_minc_volume_raw_history-Union{Tuple{String}, Tuple{T}, Tuple{String, Type{T}}} where T<:Number","page":"Low level functions","title":"Minc2.read_minc_volume_raw_history","text":"read_minc_volume_raw_history(path::String, ::Type{T}=Float32 )\n\nRead the actual volume using path return volume, representation header,storage header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.read_minc_volume_std-Union{Tuple{Minc2.VolumeHandle}, Tuple{T}, Tuple{Minc2.VolumeHandle, Type{T}}} where T<:Number","page":"Low level functions","title":"Minc2.read_minc_volume_std","text":"read_minc_volume_std(h::VolumeHandle, \n ::Type{T}=Float32 )::Tuple{Array{T}, Minc2.MincHeader, Minc2.MincHeader}\n\nRead the actual volume using handle return volume, representation header,storage header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.read_minc_volume_std-Union{Tuple{String}, Tuple{T}, Tuple{String, Type{T}}} where T<:Number","page":"Low level functions","title":"Minc2.read_minc_volume_std","text":"read_minc_volume_std(path::String, ::Type{T}=Float32 )::\n Tuple{Array{T}, Minc2.MincHeader, Minc2.MincHeader}\n\nRead the actual volume using path return volume, representation header,storage header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.read_minc_volume_std_history-Union{Tuple{String}, Tuple{T}, Tuple{String, Type{T}}} where T<:Number","page":"Low level functions","title":"Minc2.read_minc_volume_std_history","text":"read_minc_volume_std_history(path::String, ::Type{T}=Float32 )::\n Tuple{Array{T}, Minc2.MincHeader, Minc2.MincHeader, Union{String,Nothing}}\n\nRead the actual volume using path return volume, representation header,storage header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.representation_header-Tuple{Minc2.VolumeHandle}","page":"Low level functions","title":"Minc2.representation_header","text":"representation_header(h::VolumeHandle)::MincHeader\n\nReturn volume representation header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.representation_type-Tuple{Minc2.VolumeHandle}","page":"Low level functions","title":"Minc2.representation_type","text":"store_type(h::VolumeHandle)::Type\n\nQuery representation data type of the minc file, WARNING: it doesn't nacessery mean that it's the same as store_type type\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.setup_standard_order-Tuple{Minc2.VolumeHandle}","page":"Low level functions","title":"Minc2.setup_standard_order","text":"setup_standard_order(h::VolumeHandle)\n\nPrepare to read volume in standard order: [V,X,Y,Z,TIME]\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.store_header-Tuple{Minc2.VolumeHandle}","page":"Low level functions","title":"Minc2.store_header","text":"store_header(h::VolumeHandle)::MincHeader\n\nReturn volume on-disk stucture header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.store_type-Tuple{Minc2.VolumeHandle}","page":"Low level functions","title":"Minc2.store_type","text":"store_type(h::VolumeHandle)::Type\n\nQuery storage data type of the minc file, WARNING: it doesn't nacessery mean that it's the same as representation type\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.voxel_to_world-Tuple{Minc2.MincHeader}","page":"Low level functions","title":"Minc2.voxel_to_world","text":"voxel_to_world(hdr::MincHeader)::AffineTransform{Float64}\n\nGive AffineTransform for world to voxel transformation based on header\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.voxel_to_world-Tuple{Minc2.VolumeHandle, Vector{Float64}}","page":"Low level functions","title":"Minc2.voxel_to_world","text":"voxel_to_world(h::VolumeHandle,ijk::Vector{Float64})::Vector{Float64}\n\nConvert contignuous 0-based voxel indexes (I,J,K) to world coordinates (X,Y,Z) 0-based\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.world_to_voxel-Tuple{Minc2.MincHeader}","page":"Low level functions","title":"Minc2.world_to_voxel","text":"world_to_voxel(hdr::MincHeader)::AffineTransform{Float64}\n\nGive AffineTransform for voxel to world transformation\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.world_to_voxel-Tuple{Minc2.VolumeHandle, Vector{Float64}}","page":"Low level functions","title":"Minc2.world_to_voxel","text":"world_to_voxel(h::VolumeHandle, xyz::Vector{Float64})::Vector{Float64}\n\nConvert world coordinates (X,Y,Z) to contignuous voxel indexes (I,J,K) 0-based\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.write_attribute-Union{Tuple{T}, Tuple{Minc2.VolumeHandle, String, String, T}} where T","page":"Low level functions","title":"Minc2.write_attribute","text":"write_attribute(h::VolumeHandle, group::String, attribute::String, value::T)\n\nStore attribute into minc2 file :param group: group name :param attribute: attribute name :param value: attribute value :return:\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.write_history-Tuple{Minc2.VolumeHandle, String}","page":"Low level functions","title":"Minc2.write_history","text":"write_history(i::VolumeHandle, history::String)\n\nWrite history string\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.write_minc_volume_raw-Union{Tuple{Repr}, Tuple{Store}, Tuple{String, Type{Store}, Union{Nothing, Minc2.MincHeader}, Array{Repr, N} where N}} where {Store, Repr}","page":"Low level functions","title":"Minc2.write_minc_volume_raw","text":"write_minc_volume_raw(path::String, ::Type{Store}, \n store_hdr::Union{MincHeader, Nothing}, \n volume::Array{Repr};like::Union{String, Nothing}=nothing, \n history::Union{String, Nothing}=nothing )\n\nWrite full volume to file, need to provide details of file structure return nothing\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.write_minc_volume_raw-Union{Tuple{T}, Tuple{Minc2.VolumeHandle, Array{T, N} where N}} where T<:Number","page":"Low level functions","title":"Minc2.write_minc_volume_raw","text":"write_minc_volume_raw(h::VolumeHandle, volume::Array{T} )\n\nwrite full volume to file, file should be defined and created return nothing\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.write_minc_volume_std-Union{Tuple{Repr}, Tuple{Store}, Tuple{String, Type{Store}, Union{Nothing, Minc2.MincHeader}, Array{Repr, N} where N}} where {Store, Repr}","page":"Low level functions","title":"Minc2.write_minc_volume_std","text":"write_minc_volume_std(path::String, ::Type{Store}, \n store_hdr::Union{MincHeader, Nothing}, \n volume::Array{Repr};like::Union{String, Nothing}=nothing, \n history::Union{String, Nothing}=nothing )\n\nWrite full volume to file, need to provide details of file structure return nothing\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.write_minc_volume_std-Union{Tuple{T}, Tuple{Minc2.VolumeHandle, Array{T, N} where N}} where T<:Number","page":"Low level functions","title":"Minc2.write_minc_volume_std","text":"write_minc_volume_std(h::VolumeHandle, volume::Array{T} )\n\nwrite full volume to file, file should be defined and created return nothing\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.DIM","page":"Low level functions","title":"Minc2.DIM","text":"Low Level: Axis types from MINC volume\n\n\n\n\n\n","category":"type"},{"location":"low_level/#Minc2.Minc2Error","page":"Low level functions","title":"Minc2.Minc2Error","text":"MINC io exception\n\n\n\n\n\n","category":"type"},{"location":"low_level/#Minc2.MincHeader","page":"Low level functions","title":"Minc2.MincHeader","text":"MincHeader\n\nStructure describing spatial orientation and sampling of the minc file \n\n\n\n\n\n","category":"type"},{"location":"low_level/#Minc2.STATUS","page":"Low level functions","title":"Minc2.STATUS","text":"Low Level: minc2_simple API status\n\n\n\n\n\n","category":"type"},{"location":"low_level/#Minc2.VolumeHandle","page":"Low level functions","title":"Minc2.VolumeHandle","text":"VolumeHandle\n\nminc2_simple volume handle\n\n\n\n\n\n","category":"type"},{"location":"low_level/#Minc2.julia_to_minc2","page":"Low level functions","title":"Minc2.julia_to_minc2","text":"Low Level: map Julia types to minc2 data types\n\n\n\n\n\n","category":"constant"},{"location":"low_level/#Minc2.minc2_spatial","page":"Low level functions","title":"Minc2.minc2_spatial","text":"Low Level: Mapping MINC2 spatial dimensions to proper spatial dimension (should be identity for spatial dims)\n\n\n\n\n\n","category":"constant"},{"location":"low_level/#Minc2.minc2_to_julia","page":"Low level functions","title":"Minc2.minc2_to_julia","text":"Low Level: map MINC2 types to Julia\n\n\n\n\n\n","category":"constant"},{"location":"low_level/#Minc2.append_grid_transform-Tuple{Minc2.TransformHandle, String}","page":"Low level functions","title":"Minc2.append_grid_transform","text":"append_grid_transform(h::TransformHandle, grid_file::String; inv::Bool=false)\n\nLow level: Append grid transform to an open transformation handle\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.append_linear_transform-Tuple{Minc2.TransformHandle, Minc2.AffineTransform}","page":"Low level functions","title":"Minc2.append_linear_transform","text":"append_linear_transform(h::TransformHandle, lin::AffineTransform)\n\nLow level: Append affine transform to an open transformation handle\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.concat_xfm-Tuple{Minc2.TransformHandle, Minc2.TransformHandle}","page":"Low level functions","title":"Minc2.concat_xfm","text":"concat_xfm(h::TransformHandle, i::TransformHandle)\n\nLow level: concatenate two transfomations\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.get_grid_transform-Tuple{Minc2.TransformHandle}","page":"Low level functions","title":"Minc2.get_grid_transform","text":"get_grid_transform(h::TransformHandle; n::Int64=0)\n\nLow level: extract reference to a grid file from open handle\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.get_linear_transform-Tuple{Minc2.TransformHandle}","page":"Low level functions","title":"Minc2.get_linear_transform","text":"get_linear_transform(h::TransformHandle; n::Int64=0)::AffineTransform{Float64}\n\nLow level: extract AffineTransform{Float64} from open handle\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.get_linear_transform_param-Tuple{Minc2.TransformHandle}","page":"Low level functions","title":"Minc2.get_linear_transform_param","text":"get_linear_transform_param(h::TransformHandle;n::Int64=0,center::Union{Nothing,Vector{Float64}}=nothing)\n\nLow level: extact transformation parameters from affine transform , returns named tuple with fields center, translations, scales, shears, rotations\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.get_n_concat-Tuple{Minc2.TransformHandle}","page":"Low level functions","title":"Minc2.get_n_concat","text":"get_n_concat(h::TransformHandle)::Int64\n\nLow level: Get number of transformations in open handle\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.get_n_type-Tuple{Minc2.TransformHandle}","page":"Low level functions","title":"Minc2.get_n_type","text":"get_n_type(h::TransformHandle; n::Int64=0)::XFM\n\nLow level: Get transform type for nth transform in open handle\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.inverse_transform_point-Tuple{Minc2.TransformHandle, Vector{Float64}}","page":"Low level functions","title":"Minc2.inverse_transform_point","text":"inverse_transform_point(h::TransformHandle, xyz::Vector{Float64})::Vector{Float64}\n\nLow level: Inverse transform point xyz using minc transform h\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.invert_transform-Tuple{Minc2.TransformHandle}","page":"Low level functions","title":"Minc2.invert_transform","text":"invert_transform(h::TransformHandle)\n\nLow level: Invert minc transform h\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.load_transforms-Tuple{Minc2.TransformHandle}","page":"Low level functions","title":"Minc2.load_transforms","text":"load_transforms(h::TransformHandle)::Vector{AnyTransform}\n\nLow level: Load all transforms from open .XFM handle\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.load_transforms-Tuple{String}","page":"Low level functions","title":"Minc2.load_transforms","text":"load_transforms(fname::String)::Vector{AnyTransform}\n\nLoad transformations from .xfm file fname\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.open_xfm_file-Tuple{String}","page":"Low level functions","title":"Minc2.open_xfm_file","text":"Low level: Open transform xfm file, return handle\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.read_transforms-Tuple{String}","page":"Low level functions","title":"Minc2.read_transforms","text":"read_transforms(fname::String)::Vector{AnyTransform}\n\nRead transformations from .xfm file fname\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.save_transforms-Union{Tuple{XFM}, Tuple{T}, Tuple{String, Union{Vector{XFM}, XFM}}} where {T, XFM<:Minc2.AnyTransform}","page":"Low level functions","title":"Minc2.save_transforms","text":"save_transforms(fname::String, \n xfm::Union{Vector{XFM}, XFM};\n grid_store::Type{T}=Float32 ) where {T, XFM<:AnyTransform}\n\nSave transformations into .xfm file, \n\nArguments\n\nfname: output file name\nxfm: vector of transformations to save, or a single transformation\ngrid_store: type of storage for grid files (default: Float32)\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.save_xfm_file-Tuple{Minc2.TransformHandle, String}","page":"Low level functions","title":"Minc2.save_xfm_file","text":"save_xfm_file(h::TransformHandle, path::String)\n\nLow level: Save information into file from an open handle\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.transform_point-Tuple{Minc2.TransformHandle, Vector{Float64}}","page":"Low level functions","title":"Minc2.transform_point","text":"transform_point(h::TransformHandle, xyz::Vector{Float64})::Vector{Float64}\n\nLow level: Transform point xyz using minc transform h\n\n\n\n\n\n","category":"method"},{"location":"low_level/#Minc2.TransformHandle","page":"Low level functions","title":"Minc2.TransformHandle","text":"Low level: minc2_simple XFM transform handle\n\n\n\n\n\n","category":"type"},{"location":"low_level/#Minc2.XFM","page":"Low level functions","title":"Minc2.XFM","text":"@enum XFM\n\nLow level: transformation types stored in .xfm file\n\n\n\n\n\n","category":"type"},{"location":"plotting/","page":"Plotting functions","title":"Plotting functions","text":"CurrentModule = Minc2\n\nDocTestSetup = quote\n using Minc2\nend","category":"page"},{"location":"plotting/#High-level-functions-for-plotting-3D-volumes","page":"Plotting functions","title":"High level functions for plotting 3D volumes","text":"","category":"section"},{"location":"plotting/","page":"Plotting functions","title":"Plotting functions","text":"These are helper functions for plotting Volume3D objects using Makie. To make them available one must first load Makie or equivalent (i.e CairoMakie)","category":"page"},{"location":"plotting/#Show-MNI-ICBM152-template-contours-with-tissue-masks-overlays","page":"Plotting functions","title":"Show MNI-ICBM152 template contours with tissue masks overlays","text":"","category":"section"},{"location":"plotting/","page":"Plotting functions","title":"Plotting functions","text":"using CairoMakie\nusing Minc2\n\n# read T1w scan\nicbm=Minc2.read_volume(\"mni_icbm152_t1_tal_nlin_sym_09c.mnc\", store=Float64)\n# read label mask, represent it as array of bytes \nlab=Minc2.read_volume(\"mni_icbm152_cls_tal_nlin_sym_09c.mnc\", store=UInt8)\n\n\nfig = Figure()\ngc = fig[1, 1] = GridLayout()\n\nMinc2.draw_outline_with_labels(gc, icbm, lab, \n labels=Dict([1=>\"CSF\",2=>\"GM\",3=>\"WM\"]),\n nslices = 5)\n\nresize_to_layout!(fig)\n\nsave(\"mni_icbm152_segmentation.png\", fig, px_per_unit = 1)","category":"page"},{"location":"plotting/","page":"Plotting functions","title":"Plotting functions","text":"Will produce (Image: MNI-ICBM152 Segmentation)","category":"page"},{"location":"plotting/","page":"Plotting functions","title":"Plotting functions","text":"Minc2.draw_outline_with_labels","category":"page"},{"location":"plotting/#Minc2.draw_outline_with_labels","page":"Plotting functions","title":"Minc2.draw_outline_with_labels","text":"draw_outline_with_labels(\n layout, \n anat, \n seg; \n labels, \n cmap = :rainbow,\n levels = [20,30],\n show_colorbar = true,\n nslices = 4)\n\nDraws a segmentation seg on top of anat in a grid layout layout\n\nlayout is a grid layout\nanat is a Volume3D with anatomical image\nseg is a Volume3D with discrete segemntations\nlabels is a dictionary of labels to show\ncmap is a color map to use\nlevels is a list of levels of anat to use for contours\nshow_colorbar is a boolean flag to show colorbar\nnslices is a number of slices to show\n\n\n\n\n\n","category":"function"},{"location":"plotting/#Show-MNI-ICBM152-template-contours-with-GM-proability-map","page":"Plotting functions","title":"Show MNI-ICBM152 template contours with GM proability map","text":"","category":"section"},{"location":"plotting/","page":"Plotting functions","title":"Plotting functions","text":"using CairoMakie\nusing Minc2\n\n# read T1w scan\nanat=Minc2.read_volume(\"mni_icbm152_t1_tal_nlin_sym_09c.mnc\",store=Float64)\n# read field\ngm=Minc2.read_volume(\"mni_icbm152_gm_tal_nlin_sym_09c.mnc\",store=Float64)\n\nfig = Figure()\ngc = fig[1, 1] = GridLayout()\n\n# set background to transparent\nMinc2.array(gm)[Minc2.array(gm) .< 1e-6] .= NaN\n\nMinc2.draw_outline_with_heatmap(gc, anat, gm, \n heat_limits=(0.0,1.0),cmap=:turbo,\n nslices = 5)\n\nresize_to_layout!(fig)\n\nsave(\"mni_icbm152_gm.png\", fig, px_per_unit = 1) ","category":"page"},{"location":"plotting/","page":"Plotting functions","title":"Plotting functions","text":"Will produce (Image: MNI-ICBM152 GM)","category":"page"},{"location":"plotting/","page":"Plotting functions","title":"Plotting functions","text":"Minc2.draw_outline_with_heatmap","category":"page"},{"location":"plotting/#Minc2.draw_outline_with_heatmap","page":"Plotting functions","title":"Minc2.draw_outline_with_heatmap","text":"draw_outline_with_heatmap(\n layout, anat, heat; \n cmap=:rainbow, levels=[20, 40],\n heat_limits=nothing, \n show_colorbar=true,\n nslices=4)\n\nDraws a heatmap of heat on top of anat in a grid layout layout.\n\nlayout is a grid layout\nanat is a Volume3D with anatomical image\nheat is a Volume3D with overlay heatmap\nheat_limits limits for the heatmap\ncmap is a color map to use\nlevels is a list of levels of anat to use for contours\nshow_colorbar is a boolean flag to show colorbar\nnslices is a number of slices to show\n\n\n\n\n\n","category":"function"},{"location":"plotting/#Show-two-tailed-t-statistics-on-DBM-style-analysis","page":"Plotting functions","title":"Show two-tailed t-statistics on DBM style analysis","text":"","category":"section"},{"location":"plotting/","page":"Plotting functions","title":"Plotting functions","text":"using CairoMakie\nusing Minc2\n\n# read T1w scan and crop black area around ROI\nanat=Minc2.crop_volume(\n Minc2.read_volume(\"mni_icbm152_t1_tal_nlin_sym_09c.mnc\",store=Float64),\n [[15,15],[20,20],[20,20]])\n\n# Read brain ROI, should be the same sampling as anat\nmask=Minc2.crop_volume(\n Minc2.read_volume(\"mni_icbm152_t1_tal_nlin_sym_09c_mask.mnc\",store=UInt8),\n [[15,15],[20,20],[20,20]])\n\n# read statistics map, does not have to be the same resolution as anat\nvol_t=Minc2.read_volume(\"t_AD_vs_CN_2mm.mnc\",store=Float64)\n\n# statistical limits (two-tailed)\nstat_limits = [2.9 , 5]\n\n# start new figure\nfig = Figure()\n\ng1 = f[1,1] = GridLayout()\nLabel(f[1,1,Top()],\"AD vs CN-\")\n\ndraw_outline_with_heatmap_symmetric(g1, anat, mask, vol_stat;\n heat_limits=stat_limits,\n show_colorbar=true,\n cmap_pos=:YlOrRd_9,cmap_neg=:YlGnBu_9,\n nslices=5,\n colorbar_label=\"t-statistics\")\n\nresize_to_layout!(fig)\n\nsave(\"t-statistics.png\", fig, px_per_unit = 1) ","category":"page"},{"location":"plotting/","page":"Plotting functions","title":"Plotting functions","text":"(Image: T-statistics)","category":"page"},{"location":"plotting/","page":"Plotting functions","title":"Plotting functions","text":"Minc2.draw_outline_with_heatmap_symmetric","category":"page"},{"location":"plotting/#Minc2.draw_outline_with_heatmap_symmetric","page":"Plotting functions","title":"Minc2.draw_outline_with_heatmap_symmetric","text":"draw_outline_with_heatmap_symmetric(\n layout, anat, mask, heat; \n cmap_pos=:YlOrRd_9,\n cmap_neg=:YlGnBu_9,\n levels=[20, 40],\n heat_limits=nothing,\n show_colorbar=true,\n under=nothing, \n over=nothing,\n nslices=4,\n alpha=0.7,\n colorbar_label=\"\",\n slices_gap=5,\n colorbar_gap=10)\n\nDraws a two-sided (symmetric positive and negative) heatmap of heat on top of anat in a grid layout layout.\n\nlayout is a grid layout\nanat is a Volume3D with anatomical image\nmask is a Volume3D with ROI\nheat is a Volume3D with overlay heatmap, can be arbitrary sampling\nheat_limits limits for the heatmap\ncmap_pos is a color map to use for positive values, if nothing then don't show positive values\ncmap_neg is a color map to use for negative values, if nothing then don't show negative values\nlevels is a list of levels of anat to use for contours\nshow_colorbar is a boolean flag to show colorbar\ncolorbar_label is a label for the colorbar\nnslices is a number of slices to show\n\n\n\n\n\n","category":"function"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"CurrentModule = Minc2\n\nDocTestSetup = quote\n using Minc2\nend","category":"page"},{"location":"#MINC2-for-Julia","page":"Introduction to Minc2.jl","title":"MINC2 for Julia","text":"","category":"section"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"(Image: CI)","category":"page"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"Read and write MINC2 files from Julia, reading and writing .xfm transformation files, Manipulations with volumes","category":"page"},{"location":"#Examples","page":"Introduction to Minc2.jl","title":"Examples","text":"","category":"section"},{"location":"#Read-a-3D-minc-volume,-calculate-mean-value","page":"Introduction to Minc2.jl","title":"Read a 3D minc volume, calculate mean value","text":"","category":"section"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"Minc command:","category":"page"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"> mincstats -mean mni_icbm152_t1_tal_nlin_sym_09c.mnc\nMean: 29.61005195","category":"page"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"Julia version:","category":"page"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"using Minc2\nusing StatsBase\n\n# read volume from minc file, represent it as array of doubles (Float64 in julia world)\nicbm=Minc2.read_volume(\"mni_icbm152_t1_tal_nlin_sym_09c.mnc\", store=Float64)\n@show mean(Minc2.array(icbm))","category":"page"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"Output mean(Minc2.array(icbm)) = 29.61005194874031","category":"page"},{"location":"#Read-a-3D-volume-with-real-values,-and-another-one-with-mask-labels-and-show-statistics-per-label","page":"Introduction to Minc2.jl","title":"Read a 3D volume with real values, and another one with mask labels and show statistics per label","text":"","category":"section"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"using Minc2\nusing StatsBase\n\n# read T1w scan\nicbm=Minc2.read_volume(\"mni_icbm152_t1_tal_nlin_sym_09c.mnc\", store=Float64)\n# read label mask, represent it as array of bytes \nlab=Minc2.read_volume(\"mni_icbm152_cls_tal_nlin_sym_09c.mnc\", store=UInt8)\n\n# calculate image statistics per label\nfor (i,l) in [1=>\"CSF\",2=>\"GM\",3=>\"WM\"]\n println(\"$(l):$(mean(Minc2.array(icbm)[ Minc2.array(lab).==i ]))\")\nend","category":"page"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"Output:","category":"page"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"CSF:31.263195070792978\nGM:64.88399427312729\nWM:84.74593912912998","category":"page"},{"location":"#Apply-transformation-stored-in-.xfm-file-to-a-minc-volume,-save-result","page":"Introduction to Minc2.jl","title":"Apply transformation stored in .xfm file to a minc volume, save result","text":"","category":"section"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"Create transformation with minc command:param2xfm -rotations 30 0 0 rotate.xfm","category":"page"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"using Minc2\n\n# read T1w scan\nicbm=Minc2.read_volume(\"mni_icbm152_t1_tal_nlin_sym_09c.mnc\", store=Float64)\n\n# read transformation\ntfm=Minc2.load_transforms(\"rotate.xfm\")\n\n# apply transformation to the volume\ntransformed_icbm=Minc2.resample_volume(icbm; tfm, order=2, fill=0.0)\n\n# write the resulting volume into file, append history\n# the resulting volume will be stored with unsigned short minc data type\n# but will preserve floating point vales used fixe-point arithmetics\nMinc2.save_volume(\"transformed_icbm.mnc\",transformed_icbm, store=UInt16, history=\"Julia example\")","category":"page"},{"location":"#Integrate-jacobians-per-ROI,-based-on-a-transformation-in-.xfm-file","page":"Introduction to Minc2.jl","title":"Integrate jacobians per ROI, based on a transformation in .xfm file","text":"","category":"section"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"using Minc2\n\n# read ROI labels\nrois = Minc2.read_volume(\"rois.mnc\", store=UInt8)\n\n# calculate voxel volume \nstart, step, dir_cos = Minc2.decompose(Minc2.voxel_to_world(rois))\nvoxel_volume = abs(reduce(*,step,init=1))\n\n# read transformation\ntfm = Minc2.load_transforms(\"nonlinear.xfm\")\n\n# define sampling parameters for jacobian field\njacobians = Minc2.empty_volume_like(lab, store=Float64)\n\n# calculate per-voxel jacobians\nMinc2.calculate_jacobian!(tfm, jacobians)\n\n# Integrate per ROI\nfor (i,l) in [1=>\"ROI-1\",2=>\"ROI-2\",3=>\"ROI-3\"]\n println(\"$(l):$( sum((Minc2.array(rois) .== i) .* Minc2.array(jac) )*voxel_volume)\")\nend","category":"page"},{"location":"#Graphic-examples,-using-Makie","page":"Introduction to Minc2.jl","title":"Graphic examples, using Makie","text":"","category":"section"},{"location":"#Show-MNI-ICBM152-template-contours-with-tissue-masks-overlays","page":"Introduction to Minc2.jl","title":"Show MNI-ICBM152 template contours with tissue masks overlays","text":"","category":"section"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"using CairoMakie\nusing Minc2\n\n# read T1w scan\nicbm=Minc2.read_volume(\"mni_icbm152_t1_tal_nlin_sym_09c.mnc\", store=Float64)\n# read label mask, represent it as array of bytes \nlab=Minc2.read_volume(\"mni_icbm152_cls_tal_nlin_sym_09c.mnc\", store=UInt8)\n\n\nfig = Figure()\ngc = fig[1, 1] = GridLayout()\n\nMinc2.draw_outline_with_labels(gc, icbm, lab, \n labels=Dict([1=>\"CSF\",2=>\"GM\",3=>\"WM\"]),\n nslices = 5)\n\nresize_to_layout!(fig)\n\nsave(\"mni_icbm152_segmentation.png\", fig, px_per_unit = 1)","category":"page"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"Will produce (Image: MNI-ICBM152)","category":"page"},{"location":"#Show-MNI-ICBM152-template-contours-with-GM-proability-map","page":"Introduction to Minc2.jl","title":"Show MNI-ICBM152 template contours with GM proability map","text":"","category":"section"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"using CairoMakie\nusing Minc2\n\n# read T1w scan\nanat=Minc2.read_volume(\"mni_icbm152_t1_tal_nlin_sym_09c.mnc\",store=Float64)\n# read field\ngm=Minc2.read_volume(\"mni_icbm152_gm_tal_nlin_sym_09c.mnc\",store=Float64)\n\nfig = Figure()\ngc = fig[1, 1] = GridLayout()\n\n# set background to transparent\nMinc2.array(gm)[Minc2.array(gm) .< 1e-6] .= NaN\n\nMinc2.draw_outline_with_heatmap(gc, anat, gm, \n heat_limits=(0.0,1.0),cmap=:turbo,\n nslices = 5)\n\nresize_to_layout!(fig)\n\nsave(\"mni_icbm152_gm.png\", fig, px_per_unit = 1) ","category":"page"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"Will produce (Image: MNI-ICBM152)","category":"page"},{"location":"#More-examples","page":"Introduction to Minc2.jl","title":"More examples","text":"","category":"section"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"See examples directory for more examples:","category":"page"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"bloor.jl - Apply Blooring kernel to minc volume, equivalent to mincbloor\ncopy.jl - Create a minc volume with the same dimensions as another one, copy voxels\ndraw_heatmap.jl - Show MNI-ICBM152 template contours with GM proability map, as above\ndraw_seg.jl - Show MNI-ICBM152 template contours with tissue masks overlays, as above\nlist_meta.jl - List all metadata stored with minc file, similar to mincheader\nmriview_dual.jl - Show two minc volumes side-by-side, interactively\nmriview.jl - Show minc volume, interactively\nmultilabel_overlap.jl - calculate voxel-wise generalized overlap coeffecient , method from http://dx.doi.org/10.1109/TMI.2006.880587\nresample_grid.jl - apply transformation to _grid file\nresample_itk.jl - resample nifti file with transformations produces by ANTS (multiple transformations can be applied in one go), equivalent to antsApplyTransforms\nresample.jl - apply transformation to minc volume, equivalent to mincresample\nxfm_to_jacobian.jl - calculate jacobian determinant field, for a given .xfm file\nmincinfo.jl - show information about mincfile(s) and store it in csv file, equivalent to mincinfo","category":"page"},{"location":"#Documentation-for-MINC","page":"Introduction to Minc2.jl","title":"Documentation for MINC","text":"","category":"section"},{"location":"","page":"Introduction to Minc2.jl","title":"Introduction to Minc2.jl","text":"Documentations for underlying libminc and minc tools is available at https://en.wikibooks.org/wiki/MINC","category":"page"}] }