Differences between revisions 5 and 6
 Deletions are marked like this. Additions are marked like this. Line 62: Line 62: * Visualize results with tkmedit or [wiki:Scuba2Guide/ScubaWorkingWithData/Scuba2POI scuba2] * Visualize results with tkmedit or [[Scuba2Guide/ScubaWorkingWithData/Scuba2POI|scuba2]]

# Poistats Overview

The goal of the POIStats (Path-of-Interest Statistics) algorithm is to calculate the highest probability path between two user-defined seed regions from magnetic resonance diffusion tensor data. The best path is determined by minimizing the energy of the entire path through randomization of the position of the control points of a spline curve drawn through the data and of the position of the endpoints. The energy of each point in the path is given by the negative natural logarithm of the scaled orientation density function at that point. The magnitude of the perturbation is time-step dependent  the magnitude is decreased exponentially with time step number. A set of replicates are used to explore the path parameter space and minimization of the path energy is achieved using a Metropolis algorithm with a constant percentage reduction of the temperature. The Metropolis algorithm accepts a path if its energy is less than that of the current lowest energy path; otherwise it accepts the path with a probability based on the difference in energy between the current path and the current best path normalized by the current temperature. Replicates can be exchanged between temperature baths and the exchange is determined also using a Metropolis algorithm.

## Creating seed regions

Poistat is constrained to the start and end point, so you'll need to be careful in placing them. You'll need at least two seed regions, a start and an end region. Intermediate seed regions can be used to give poistats hints when initializing the path, which could result in more probably optimal paths and in faster run times. However, unlike the start and end points, the path will not be constrained to these intermediate points. Follow these instructions for creating seed regions:

1. start tkmedit loading the fa as the initial volume. For example:
`tkmedit -f fa.nii`

3. In the Load DTI Volume window, browse for the two volume with the Browse... button. In Load DTI Vector Volume, load the eigenvec1 volume and in Load DTI FA Volume browse for the fa volume. Click OK when you've found the volumes. The DTI volumes will be loaded and this could take a moment.

4. Create a new segmentation File->New Segmentation.

5. You can either use the default "FreeSurferColorLUT.txt" file or create your own. Click Browse... to locate the file and OK to create the new segmentation. The benefit of creating your ownis that you can use distinct colors, so it's easier to determine a region from another, for example you could create a file with the following:

```#No. Label Name:                            R   G   B   A

0   Unknown                                 0   0   0   0
1   ROI-1                                   0   0   205 0
2   ROI-2                                   124 252 0   0
3   ROI-3                                   255 255 0   0
4   ROI-4                                   255 0   0   0
5   ROI-5                                   138 43  226 0
6   ROI-6                                   255 127 0   0
7   ROI-7                                   176 48  96  0
8   ROI-8                                   160 82  45  0
9   ROI-9                                   85  107 47  0
10  ROI-10                                  0   206 209 0```
6. Navigate tkmedit to where the starting region is.
7. Label the first region going to Tools->Configure Segmentation Brush... This opens the Segmentation Brush Info window.

8. In the Segmentation Brush Info window under "Color," select the first label. If you'd like, keep this window open, since you'll be changing the segmentation brush again to label other regions.

9. Change to the segmentation brush by clicking on the Edit Segmentation Tool button.

10. Annotate the seed region by moving the mouse cursor over the pixel that should be included in the region and clicking with the middle button. You may want to move through various slices and validate your selectiong by turning the DTI overlay on and off with Ctrl D or View->DTI Overlay.

11. Annotate another region by selecting another label from the Segmentation Brush Info window and repeating the previous step for as many regions as you'd like.

12. Save the seed regions by going to File->Save Segmentation As. Enter a name for the volume and click OK.