## Streamlines (Image3d)

Streamline allows the tracking of channels or structures from a vector field (for example, from Diffusion). It creates streamlines based on seed points and a vector field.

You can find a Matlab implementation here:
Kupczik K, Stark H, Mundry R, Neininger F, Heidlauf T, Röhrle O (2015). Reconstruction of muscle fascicle architecture from iodine-enhanced microCT images: a combined texture mapping and streamline approach. Journal of Theoretical Biology 382 (7): 34–43. DOI:10.1016/j.jtbi.2015.06.034 / ISSN:0022-5193

In this example, we use a part of an image stack from Julian Sartori (Thanks for the support!), which shows the achilles tendon of a rat.

Download: Image stack

And the results from Diffusion.

Download: Vector stack
Download: Reduced vector stack

First step
Calculate the streamlines from the vector field.

▸ Image3d

``` vector.load "stack_vector.nii.gz" vector.smooth 3 //line.stream // calculate streamlines with steps 1 for all seed points line.stream.random 1000 line.save "stream.lines" // output for cloud2 line.save.trackvis "stream.trk" // output for the software Trackvis vector.load "stack_reduce.nii.gz" line.new //line.stream // calculate streamlines with steps 1 for all seed points line.stream.random 1000 line.save "stream_reduce.lines" // output for cloud2 line.save.trackvis "stream_reduce.trk" // output for the software Trackvis ```

▸ More details

``` // line.adaptive := 1 // 0:all, 1:only at new points, 2:only at new points around -1..1, ... // line.stream // calculate streamlines with steps 1 for all seed points // line.stream 2 // calculate streamlines with steps 2 for all seed points // line.stream 2 5 // calculate streamlines with steps 2 and segment angle 5° for all seed points // line.random 100 // calculate 100 streamlines with steps 1 // line.random 100 ... // calculate 100 streamlines // ... see above ```

Second step
Evaluation (with cloud2 please use *.lines).

 stream.lines (x,y view) stream_reduce.lines (x,y view) stream.lines (y,z view) stream_reduce.lines (y,z view)

▸ Cloud2

``` calculate.fit.lines.degree 5 1 ```

 stack.lines (x,y view)
 stack.lines (y,z view)