Skip to content

Commit ada15ad

Browse files
authored
Update README.md
1 parent 0e9502d commit ada15ad

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

README.md

+27-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
# ImageInterpLast
22

3-
This package allows setting interpolation coefficients on a per-slice basis. This allows one to compensate for non-simultaneous sampling of multiple image planes in a stack.
3+
This package uses interpolation to compensate for sampling time differences that occur when a sequence of 3D image "stacks" is assembled from a sequence of 2D snapshots.
44

5-
More thorough docs are on the way.
5+
```julia
6+
using ImageInterpLast
7+
8+
#Lazy interpolation between "forward" stacks and "reverse" stacks in a bidirectional recording
9+
10+
img = rand(10,10,10,10) #suppose this is a 4D image sequence (3D + time)
11+
12+
coef = 0.5 #interpolation coefficient, 0.5 means simply average neighboring values
13+
14+
#Construct an interpolated image.
15+
#This does not allocate memory, except for a cache holding data for the current image slice (reduces the number of reads from disk)
16+
img_itp = interp_last(img, coef; cache3d=false, out_type=Float32)
17+
18+
#(cache3d=true would cache an entire 3D "stack" instead)
19+
20+
@show size(img)
21+
@show size(img_itp) #one less in the time dimension due to interpolation
22+
23+
#Index the object like an AbstractArray. Interpolated values are computed on-demand.
24+
#The statement below returns the pixel-wise average of stacks 3 and 4 (i.e. img[:,:,:,3] .* 0.5 + img[:,:,:,4] .* 0.5)
25+
stack3 = img_itp[:,:,:,3]
26+
27+
#If needed you can also interpolate with a different coefficient for each 2D slice of a stack.
28+
#To do this simply pass a vector of coefficients to interp_last.
29+
#This would be useful for resampling an image timeseries acquired with conventional unidirectional scanning.
30+
```

0 commit comments

Comments
 (0)