/**

\page Usage Usage Details

This manual is divided in the following sections:
- \subpage overview "Overview"
- \subpage interaction "Interaction Details"
- \subpage appUsage "Application Usage"
- \subpage segUsage "Segmentation Usage"
- \subpage feaUsage "Feature Panel Usage"

*/

/** 


\page overview Overview
## Supported Image Types and Modalities

CaPTk always assumes the multi-modal data is coregistered and skull-stripped (in case of brains). This constraint will be removed in a future release.


Currently, CaPTk supports NIfTI (extensions <b>.nii.gz</b>, <b>.nii</b>) and DICOM (extension <b>.dcm</b>) images with the following types of MRI modalities:


-# T1
-# T2
-# T1CE or T1-Gd
-# FLAIR
-# Perfusion (we assume DSC-MRI as Perfusion for simplicity)
-# DTI (non-visualization)


## Visualization 
- CaPTk presents visualization of images based on the physical coordinate system of the
image (i.e., it takes the origin and direction information within the
image file into account while doing rendering). In practice, this use of a
consistent coordinate framework means
that images that have different origins appear visually mis-aligned (shifted)
when compared to other neuro-imaging software packages which do rendering
based on the cartesian coordinate information in the image.

- CaPTk has been optimized for monitors with 16:9 resolution, especially 1920x1080 at 100% scaling. More resolutions and scaling options are being actively tested and support will increase in subsequent releases.


\page interaction Interaction Details
## Image Loading

All the file types are loaded from the <b>File -> Load</b> menu. 

\image html 1_loading.png
\image latex 1_loading.png

Sliders control the movement across respective axes (the single horizontal slider controls across the temporal axis for Perfusion).

Various basic operations such as adjusting contrast and brightness (right mouse button click + horizontal/vertical drag on the visualization pane), window and level set (bottom panel) are available for the user. The bottom panel also shows basic information about the image and the currently selected coordinate.

## Tab Docking

Double clicking on the tab bar will dock/undock the entire section (highlighted in red). This behavior is replicated by single click of the dock/undock button (highlighted in yellow).

\image html 2_dock.png
\image latex 2_dock.png

## Initializing Seed Points

Below the <b>Seed Points</b> tab, there are two general types of
initializations - tumor points and tissue points. The controls to add/remove
points are the same as above. The radio buttons control which initialization
type is selected and related functions.

\image html 3_seeds.png
\image latex 3_seeds.png

### Tumor Points

These are basically seed points that have a coordinate and a radius. These are helpful for applications like tumor growth model simulation. The controls are as follows:

<table border="0">
  <tr><th>Key Stroke <th>Function
  <tr><td align="center" width="100px">Shift + Space <td align="center">Set initial tumor center
  <tr><td align="center">Ctrl + Space <td align="center">Update tumor radius
  <tr><td align="center">Space <td align="center">Update tumor center
</table>

### Tissue Points

These are basically seed points with just coordinate information. They can be used for a multitude of applications where manual initialization(s) are required for a semi-automated algorithm. There are various tissues that can be initialized in this panel:

<table border="0">
  <tr><th>Tissue Acronym <th>Full Form
  <tr><td align="center">CSF <td align="center">Cerebrospinal Fluid
  <tr><td align="center">VT <td align="center">Ventricular Cerebrospinal Fluid
  <tr><td align="center">GM <td align="center">Gray Matter
  <tr><td align="center">WM <td align="center">White Matter
  <tr><td align="center">VS <td align="center">Vessels
  <tr><td align="center">ED <td align="center">Edema
  <tr><td align="center">NCR <td align="center">Necrosis
  <tr><td align="center">TU <td align="center">Enhancing Tumor
  <tr><td align="center">NE <td align="center">Non-Enhancing Tumor
  <tr><td align="center">CB <td align="center">Cerebellum
  <tr><td align="center">CAE <td align="center">Enhancing Cavity
  <tr><td align="center">CAN <td align="center">Non-Enhancing Cavity
  <tr><td align="center">RTN <td align="center">Tumor Recurrence
  <tr><td align="center">RTE <td align="center">Enhanced Tumor Recurrence
</table>

Application-specific tissue types are automatically enabled when the
corresponding application is selected. For example, when trying to initialize
tissue points for GLISTR, only CSF, GM, WM, VS, ED, NCR, TU, NE and CB buttons
will be enabled and the rest will be disabled. If there are some required
tissue types missing for an application, CaPTk will display a warning and not let the user save the incorrect tissue points.

Loading and saving is done via text files in a format consistent with similar
applications. Seed-point files are needed for the following applications (and all derivatives): <a href="https://www.cbica.upenn.edu/sbia/software/glistr/">GLISTR</a>, GLISTRBoost (BRATS 2015 Winning Algorithm) and <a href="https://www.cbica.upenn.edu/sbia/software/portr/">PORTR</a>.

## Drawing Regions of Interest (ROI)

ROIs are useful for applications that need a mask as input. There are the following controls underneath the <b>Drawing</b> tab:

<table border="0">
  <tr><th>Buttons <th>Description
  <tr><td align="center" width="15%">View Mode <td>Switch from drawing mode (which is enabled when either Near or Far ROI drawing is selected) to normal viewing mode
  <tr><td align="center">Marker Size <td>A square marker of specific voxel size. Acts as size for Near and Far ROIs and for eraser
  <tr><td align="center">Near ROI <td>Highlighted in Red and saved as value <b>150</b> in the 0-255 space
  <tr><td align="center">Far ROI <td>Highlighted in Green and saved as value <b>255</b> in the 0-255 space
  <tr><td align="center">Erase Voxels <td>This acts as an eraser for both Near and Far ROIs
  <tr><td align="center">Clear <td>Separate buttons to clear Near and Far ROIs
  <tr><td align="center">Undo <td>Undos last drawing action
</table>

*/

/**

\page appUsage Application Usage

# EGFRvIII Surrogate Index

This evaluates the EGFRvIII status in individual primary glioblastoma patients, by quantitative pattern analysis of the spatial heterogeneity of peritumoral perfusion imaging dynamics from pre-operative Dynamic Susceptibility Contrast Magnetic Resonance Imaging (DSC-MRI) scans, through the Peritumoral Heterogeneity Index (PHI / φ-index) [1,2].

REQUIRED IMAGES:

-# Post-contrast T1-weighted (T1-Gd): To annotate the immediate peritumoral region of interest (ROI)
-# T2-weighted Fluid Attenuated Inversion Recovery (T2-FLAIR): To annotate the distant peritumoral ROI
-# Dynamic susceptibility contrast-enhanced MRI (DSC-MRI): To perform the analysis

USAGE:

- Annotate 2 ROIs: one near (label 1) the enhancing tumor and another far (label 2) from it (but still within the peritumoral region).
- Once the 2 ROIs are annotated, the application can be launched by using the menu option: 'Applications -> EGFRvIII Surrogate Index'.
- A pop-up window appears displaying the results (within ~1 minute).

# Glioblastoma Infiltration Index (Recurrence)

This presents the imaging signatures of deeply infiltrating tumor which largely agree with subsequent recurrence in de novo glioblastoma patients, via multi-parametric imaging pattern analysis that enhances the spatial heterogeneity of peritumoral edema. [3,4]

REQUIRED IMAGES:

-# T1-weighted (T1)
-# Post-contrast T1-weighted (T1-Gd)
-# T2-weighted (T2)
-# T2-weighted Fluid Attenuated Inversion Recovery (T2-FLAIR)
-# Diffusion Tensor Imaging (DTI) images: AX, B0, FA, RAD, TR
-# Dynamic susceptibility contrast-enhanced MRI (DSC-MRI)

USAGE:

- Annotate 3 ROIs: one near (label 1) the enhancing tumor, one far (label 2) from it (but still within the peritumoral region) and another within tumor (label 3) (please see sample drawing for details how to draw a correct ROI).
- Once the ROIs are initialized, the application can be launched by using the menu option: 'Applications -> Glioblastoma Infiltration Index'.
- A pop-up dialog opens up showing the recurrence panel.
- For subject-based training, select the features on which the model should be trained on (ideally it should be all, including Distance)
- Select output directory and click on 'Confirm'.
- A pop-up window appears displaying the results (within ~20 minutes).

NOTE: Currently, the user only has the option to train a new classifier based on their data and do testing on that trained classifier. In the future, a classifier trained on a large cohort will be provided.

# Survival Prediction Index

This tool extracts and employs distinctive imaging biomarkers predictive of an individual patient’s survival to predict patients’ survival in de novo glioblastoma patients via multi-parametric MR imaging pattern analysis which might assist in personalized treatment. [5-7]

REQUIRED IMAGES:

-# T1-weighted (T1)
-# Post-contrast T1-weighted (T1-Gd)
-# T2-weighted (T2)
-# T2-weighted Fluid Attenuated Inversion Recovery (T2-FLAIR)
-# Diffusion Tensor Imaging (DTI) images: AX, FA, RAD, TR
-# Dynamic susceptibility contrast-enhanced MRI (DSC-MRI)
-# Segmentations for the following tissues:
  - Ventricles (label 10)
  - Peritumoral Edema (label 100)
  - Non-Enhancing core of tumor (label 175)
  - Enhancing tumor (label 200)

USAGE:

Training process:

- As inputs, user needs to select TrainingDirectory and OutputDirectory.

- In the TrainingDirectory, the data of each subject should be in separate folders such as : <br>
/AAAA, /AAAB, /AAAC

- In each subject folder, there should be the following sub-folders
  - AAAA/SEGMENTATION (one file for segmentation of the tumor)
  - AAAA/DTI (AX, FA, RAD, TR)
  - AAAA/PERFUSION (RCBV, PSR, PH)
  - AAAA/T1 (T1 image)
  - AAAA/T2 (T2 image)
  - AAAA/T1CE (Post-contrast T1-weighted image)
  - AAAA/FLAIR (Flair image)

Each sub-folder must hold images with filenames
that include the corresponding modality, such as t1, t1ce for T1 and T2 images and
"labels" tag, in the name for segmentation, as in "AAAC0_t1ce_pp.nii"

- There will be two model files generated as output; one for 6 months
prediction and the other for 18 months prediction. The application will also write "mean.csv" and "std.csv" files to be used to z-score test subjects.  

Testing process:

- As inputs, user needs to select TestDirectory and ModelDirectory.

- The data in TestDirectory should be organized the same way as in TrainingDirectory. ModelDirectory will have the files written as output of the training phase. 

- A csv file having SPI indices of all the test subjects is written as output.

NOTE: Currently, the user only has the option to train a new classifier based on their data and do testing on that trained classifier. In the future, a classifier trained on a large cohort will be provided.

# Confetti

This is a method for automated extraction of white matter tracts of interest in a consistent and comparable manner over a large group of subjects without drawing the inclusion and exclusion regions of interest (ROI), facilitating an easy correspondence between different subjects, as well as providing a representation that is robust to edema, mass effect, and tract infiltration [8-10].

REQUIRED IMAGES:

-# Parcellation of the brain into 87 Desikan/Freesurfer gray matter (GM) regions [11]
-# 87 Track Density Images (TDI): For each region (among 87 GM regions), voxel-wise map of number of fibers connecting to the region
-# Streamlines (fibers) to be clustered: Either in Trackvis (.trk) or Camino (.Bfloat) format.

USAGE:

- Open Confetti UI using the 'Applications -> Confetti' menu option.
- Load the required images using "Streamline File" and "TDI Directory".
- Specify the output directory and click on 'Run Confetti'.

# WhiteStripe

This algorithm normalizes conventional magnetic resonance images [13] by detecting a latent subdistribution of normal tissue and linearly scaling the histogram of the images.

REQUIRED IMAGES:

-# Inhomogeneity-corrected (N3 or N4) T1-weighted or T2-weighted images, ideally either skull-stripped or rigidly aligned to MNI space.

USAGE:

- Launch the WhiteStripe UI using the 'Applications -> WhiteStripe' menu option.
- Specify the Input and Output files and different parameters (defaults are populated).
- Click on 'Run WhiteStripe" and the results can be seen in a slice format using "Toggle Mask/Image" checkbox.
- Use 'Level Display' when needed.
- Batch Processing can be done using similar options under the specific tab.

NOTE: WhiteStripe uses <a href="https://github.com/glentner/KernelFit">KernelFit</a> library from Lentner.


# Radiomics Analysis of Lung Cancer (SBRT Lung)

“Radiomics Analysis of Lung Cancer” calculates quantitative imaging measures including Intensity statistics, Gray Level Co-occurrence Matrix (GLCM), Gray Level Run-Length Matrix (GLRLM), Local Binary Patterns (LBPs), and shape features from PET/CT scans of lung cancer patients for predicting clinical outcomes, such as treatment response and patient survival using pattern recognition and machine learning techniques [14].

REQUIRED IMAGES:

-# CT image
-# PET image (coregistered to the CT image)

USAGE:

- Once the images have been loaded, click on 'SBRT Segment' from the 'Applications' menu.
- The mask is automatically loaded. Please correct the mask as required (it should ideally cover the lesions in the lung).
- Click on 'SBRT Analyze' from the 'Applications' menu.
- The prediction result comes up in a pop-up box.

NOTE: SBRT uses a pre-trained model for estimation; in the future we will provide a mechanism to do training on own data.

References:

[1] S. Bakas, H. Akbari, J. Pisapia, M. Rozycki, D. M. O'Rourke, C. Davatzikos, "Identification of Imaging Signatures of the Epidermal Growth Factor Receptor Variant III (EGFRvIII) in Glioblastoma", Neuro-Oncology, 17(Suppl.5):V154, 2015, doi: 10.1093/neuonc/nov225.05

[2] S. Bakas, H. Akbari, J. Pisapia, M. Martinez-Lage, M. Rozycki, S. Rathore, N. Dahmane, D. M. O’Rourke, C. Davatzikos. "In vivo detection of EGFRvIII in glioblastoma via perfusion magnetic resonance imaging signature consistent with deep peritumoral infiltration: the φ-index", Clinical Cancer Research, 2017 (Under Review)

[3] Akbari H, Macyszyn L, Da X, Bilello M, Wolf RL, Martinez-Lage M, Biros G, Alonso-Basanta M, O'Rourke DM, Davatzikos C. Imaging Surrogates of Infiltration Obtained Via Multiparametric Imaging Pattern Analysis Predict Subsequent Location of Recurrence of Glioblastoma. Neurosurgery. 2016 Apr 1; 78(4):572-80.

[4] Akbari H, Macyszyn L, Da X, Wolf RL, Bilello M, Verma R, O’Rourke DM, Davatzikos C. Pattern analysis of dynamic susceptibility contrast-enhanced MR imaging demonstrates peritumoral tissue heterogeneity. Radiology. 2014 Jun 19;273(2):502-10.

[5] Macyszyn L, Akbari H, Pisapia JM, Da X, Attiah M, Pigrish V, Bi Y, Pal S, Davuluri RV, Roccograndi L, Dahmane N. Imaging patterns predict patient survival and molecular subtype in glioblastoma via machine learning techniques. Neuro-oncology. 2016 Mar 1;18(3):417-25.

[6] Akbari H, Macyszyn L, Da X, Wolf RL, Bilello M, Verma R, O’Rourke DM, Davatzikos C. Pattern analysis of dynamic susceptibility contrast-enhanced MR imaging demonstrates peritumoral tissue heterogeneity. Radiology. 2014 Jun 19;273(2):502-10.

[7] H. Akbari, L. Macyszyn, J. Pisapia, X. Da, M. Attiah, Y. Bi, S. Pal, R. Davuluri, L. Roccograndi, N. Dahmane, R. Wolf, M. Bilello, D. O’ Rourke, C. Davatzikos, Survival Prediction in Glioblastoma Patients Using Multi-parametric MRI Biomarkers and Machine Learning Methods, ASNR 2015; American Society of Neuroradiology; O-525, pp. 2042-2044 (http://www.asnr.org/sites/default/files/proceedings/2015_Proceedings.pdf)

[8] B. Tunç, M. Ingalhalikar, D. Parker, J. Lecoeur, R. L. Wolf, L. Macyszyn, S. Brem, R. Verma, Individualized Map of White Matter Pathways: Connectivity-based Paradigm for Neurosurgical Planning, Neurosurgery, Vol. 79 (4), pp. 568-77, 2016.

[9] B. Tunç, W. A. Parker, M. Ingalhalikar, R. Verma, Automated tract extraction via atlas based Adaptive Clustering, NeuroImage, Vol. 102 (2), pp. 596-607, 2014.

[10] B. Tunç, A. R. Smith, D. Wasserman, X. Pennec, W. M. Wells, R. Verma, K. M. Pohl, Multinomial Probabilistic Fiber Representation for Connectivity Driven Clustering, Information Processing in Medical Imaging (IPMI), 2013.

[11] Fischl B, Sereno MI, Dale AM: Cortical surface-based analysis. II: Inflation, flattening, and a surface-based coordinate system. Neuroimage 9:195–207, 1999.

[12] Desikan RS, Segonne F, Fischl B, Quinn B, Dickerson B, Blacker D, Buckner R, Dale A, Maguire R, Hyman B, Albert M, Killiany R: An automated labeling system for subdividing the human cerebral cortex on MRI scans into gyral based regions of interest. Neuroimage 31, 2006.

[13] R.T. Shinohara, E.M. Sweeney, J. Goldsmith, et al. Statistical normalization techniques for magnetic resonance imaging. Neuroimage Clinical, 2014

[14] H. Li, M. Galperin-Aizenberg, D. Pryma, C. Simone, Y. Fan, “Predicting treatment response and survival of early-stage non-small cell lung cancer patients treated with stereotactic body radiation therapy using unsupervised two-way clustering of radiomic features”, The 2017 International Workshop on Pulmonary Imaging (Submitted)

*/

/**

\page segUsage Segmentation Usage

## Geodesic Segmentation

The geodesic distance based segmentation is a semi-automatic technique to generate masks for specific tissue types. 

REQUIREMENTS:

A single image with distinct boundaries for tissue needing to be segmented. [1]

USAGE:

- Using Label 1 from the drawing tab, annotate a continuous region of the tissue you would like to segment in the image. 
- After that, select "Geodesic Segmentation" from the Applications menu. 
- The mask is populated within ~5 minutes.

## ITK-SNAP

<a href="http://www.itksnap.org/pmwiki/pmwiki.php">ITK-SNAP</a> is a
stand-alone software
application used to segment structures in 3D medical images and other
utilities.
Within CaPTk specifically, ITK-SNAP is tightly integrated as a tool used for
segmentation, accepting files chosen through the CaPTk interface and returning
results for further use within CaPTk. ITK-SNAP uses a combination of random forests and level sets to obtain very precise segmentations of generic tissues [2]. Please see the following video for detailed instructions: https://www.youtube.com/watch?v=-gBcFxKf-7Q


References:

[1] B. Gaonkar, L. Shu, G. Hermosillo, Y. Zhan, Adaptive geodesic transform for segmentation of vertebrae on CT images. Conference Papers SPIE Medical imaging, 2014 (Oral)

[2] P. Yushkevich, Y. Gao, G. Gerig. ITK-SNAP: An interactive tool for semi-automatic segmentation of multi-modality biomedical images. Annual International Conference of the IEEE Engineering in Medicine and Biology Society. 2016.

*/

/**

\page feaUsage Feature Panel Usage

This panel enables analysis of images by calculating radiomics features like
Intensity statistics, Gray Level Co-occurrence Matrix (GLCM), Gray Level
Run-Length Matrix (GLRLM), Local Binary Patterns (LBPs), and shape features of
the selected region in the input.
The panel accepts neuro and torso images and
provides options for the user to select the required features needed. It also
has options on running multiple co-registered input images. The generated
features are written to an XML file.

The XML file can be used as input to other applications requiring image
features.

REQUIREMENTS:

-# Any image
-# Its corresponding mask

USAGE:

- Load the image and the mask (if no mask is present then draw a region of interest using whichever label - currently label differentiation is not done)
- Select the type of the image 
  - Neuro or torso - predefined features checked on.
  - Custom – check on the features needed. 
- Select the image for feature selection or give 'All Images' under 'Image Selection' dialog.
- Click on browse button and provide a location for the XML output file.
- Click compute. 
- The results are saved in the specified file.

*/
