Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitk::ConnectomicsNetworkCreator Class Reference

Creates connectomics networks from fibers and parcellation. More...

#include <mitkConnectomicsNetworkCreator.h>

Inheritance diagram for mitk::ConnectomicsNetworkCreator:
Collaboration diagram for mitk::ConnectomicsNetworkCreator:

Public Types

enum  MappingStrategy { EndElementPosition, EndElementPositionAvoidingWhiteMatter, JustEndPointVerticesNoLabel, PrecomputeAndDistance }
 
typedef itk::Image< int, 3 > ITKImageType
 
typedef itk::Point< float, 3 > PointType
 
typedef itk::VectorContainer< unsigned int, PointTypeTractType
 
typedef itk::VectorContainer< unsigned int, TractType::Pointer > TractContainerType
 
typedef mitk::ConnectomicsNetwork::VertexDescriptorType VertexType
 
typedef mitk::ConnectomicsNetwork::EdgeDescriptorType EdgeType
 
typedef mitk::ConnectomicsNetwork::NetworkNode NetworkNode
 
typedef std::pair< VertexType, VertexTypeConnectionType
 
typedef int ImageLabelType
 
typedef std::pair< ImageLabelType, ImageLabelTypeImageLabelPairType
 

Public Member Functions

 mitkClassMacroItkParent (ConnectomicsNetworkCreator, itk::Object)
 
Pointer Clone () const
 
void CreateNetworkFromFibersAndSegmentation ()
 
void SetFiberBundle (mitk::FiberBundle::Pointer fiberBundle)
 
void SetSegmentation (mitk::Image::Pointer segmentation)
 
mitk::ConnectomicsNetwork::Pointer GetNetwork ()
 
virtual void SetMappingStrategy (MappingStrategy _arg)
 
virtual void SetEndPointSearchRadius (double _arg)
 
virtual void SetZeroLabelInvalid (bool _arg)
 
void CalculateCenterOfMass ()
 Calculate the locations of vertices. More...
 

Static Public Member Functions

static Pointer New ()
 

Protected Member Functions

 ConnectomicsNetworkCreator ()
 
 ConnectomicsNetworkCreator (mitk::Image::Pointer segmentation, mitk::FiberBundle::Pointer fiberBundle)
 
 ~ConnectomicsNetworkCreator ()
 
void AddConnectionToNetwork (ConnectionType newConnection)
 
VertexType ReturnAssociatedVertexForLabel (ImageLabelType label)
 
ConnectionType ReturnAssociatedVertexPairForLabelPair (ImageLabelPairType labelpair)
 
ImageLabelPairType ReturnLabelForFiberTract (TractType::Pointer singleTract, MappingStrategy strategy)
 
void SupplyVertexWithInformation (ImageLabelType &label, VertexType &vertex)
 
std::string LabelToString (ImageLabelType &label)
 
bool IsNonWhiteMatterLabel (int labelInQuestion)
 
bool IsBackgroundLabel (int labelInQuestion)
 
void LinearExtensionUntilGreyMatter (std::vector< int > &indexVectorOfPointsToUse, TractType::Pointer singleTract, int &label, itk::Index< 3 > &mitkIndex)
 
void RetractionUntilBrainMatter (bool retractFront, TractType::Pointer singleTract, int &label, itk::Index< 3 > &mitkIndex)
 
std::vector< double > GetCenterOfMass (int label)
 Get the location of the center of mass for a specific label This can throw an exception if the label is not found. More...
 
itk::Point< float, 3 > GetItkPoint (double point[3])
 
void CreateNewNode (int label, itk::Index< 3 >, bool useIndex)
 Creates a new node. More...
 
ImageLabelPairType EndElementPositionLabel (TractType::Pointer singleTract)
 
ImageLabelPairType PrecomputeVertexLocationsBySegmentation (TractType::Pointer singleTract)
 
ImageLabelPairType JustEndPointVerticesNoLabelTest (TractType::Pointer singleTract)
 
ImageLabelPairType EndElementPositionLabelAvoidingWhiteMatter (TractType::Pointer singleTract)
 
void FiberToSegmentationCoords (mitk::Point3D &fiberCoord, mitk::Point3D &segCoord)
 
void SegmentationToFiberCoords (mitk::Point3D &segCoord, mitk::Point3D &fiberCoord)
 

Protected Attributes

mitk::FiberBundle::Pointer m_FiberBundle
 
mitk::Image::Pointer m_Segmentation
 
ITKImageType::Pointer m_SegmentationItk
 
mitk::ConnectomicsNetwork::Pointer m_ConNetwork
 
int idCounter
 
std::map< ImageLabelType, VertexTypem_LabelToVertexMap
 
std::map< ImageLabelType, NetworkNodem_LabelToNodePropertyMap
 
bool allowLoops
 
bool m_UseCoMCoordinates
 
std::map< int, std::vector< double > > m_LabelsToCoordinatesMap
 
MappingStrategy m_MappingStrategy
 
double m_EndPointSearchRadius
 
bool m_ZeroLabelInvalid
 
bool m_AbortConnection
 

Static Protected Attributes

static const int freesurfer_Left_Cerebral_White_Matter
 
static const int freesurfer_Left_Cerebellum_White_Matter
 
static const int freesurfer_Left_Cerebellum_Cortex
 
static const int freesurfer_Brain_Stem
 
static const int freesurfer_Right_Cerebral_White_Matter
 
static const int freesurfer_Right_Cerebellum_White_Matter
 
static const int freesurfer_Right_Cerebellum_Cortex
 

Detailed Description

Creates connectomics networks from fibers and parcellation.

This class needs a parcellation image and a fiber image to be set. Then you can create a connectomics network from the two, using different strategies.

Definition at line 42 of file mitkConnectomicsNetworkCreator.h.

Member Typedef Documentation

Types for labels

Definition at line 80 of file mitkConnectomicsNetworkCreator.h.

Type for Images

Definition at line 65 of file mitkConnectomicsNetworkCreator.h.

typedef itk::Point<float,3> mitk::ConnectomicsNetworkCreator::PointType

Types for the standardized Tract

Definition at line 68 of file mitkConnectomicsNetworkCreator.h.

typedef itk::VectorContainer< unsigned int, TractType::Pointer > mitk::ConnectomicsNetworkCreator::TractContainerType

Definition at line 70 of file mitkConnectomicsNetworkCreator.h.

typedef itk::VectorContainer<unsigned int, PointType> mitk::ConnectomicsNetworkCreator::TractType

Definition at line 69 of file mitkConnectomicsNetworkCreator.h.

Member Enumeration Documentation

Enum for different ways to create the mapping from fibers to network

Enumerator
EndElementPosition 
EndElementPositionAvoidingWhiteMatter 
JustEndPointVerticesNoLabel 
PrecomputeAndDistance 

Definition at line 48 of file mitkConnectomicsNetworkCreator.h.

Constructor & Destructor Documentation

mitk::ConnectomicsNetworkCreator::ConnectomicsNetworkCreator ( )
protected

Definition at line 34 of file mitkConnectomicsNetworkCreator.cpp.

mitk::ConnectomicsNetworkCreator::ConnectomicsNetworkCreator ( mitk::Image::Pointer  segmentation,
mitk::FiberBundle::Pointer  fiberBundle 
)
protected

Definition at line 51 of file mitkConnectomicsNetworkCreator.cpp.

References mitk::CastToItkImage(), and m_SegmentationItk.

mitk::ConnectomicsNetworkCreator::~ConnectomicsNetworkCreator ( )
protected

Definition at line 68 of file mitkConnectomicsNetworkCreator.cpp.

Member Function Documentation

void mitk::ConnectomicsNetworkCreator::AddConnectionToNetwork ( ConnectionType  newConnection)
protected

Add a connection to the network

Definition at line 142 of file mitkConnectomicsNetworkCreator.cpp.

References MITK_DEBUG.

void mitk::ConnectomicsNetworkCreator::CalculateCenterOfMass ( )

Calculate the locations of vertices.

Calculate the center of mass for each label and store the information. This will need a set parcellation image. Unless this function is called the first location where a label is encountered will be used. After calling this function the center of mass will be used instead.

Definition at line 759 of file mitkConnectomicsNetworkCreator.cpp.

References max(), and min().

Pointer mitk::ConnectomicsNetworkCreator::Clone ( ) const
void mitk::ConnectomicsNetworkCreator::CreateNetworkFromFibersAndSegmentation ( )

Given a fiber bundle and a parcellation are set, this will create a network from both

Definition at line 92 of file mitkConnectomicsNetworkCreator.cpp.

References mitk::ConnectomicsConstantsManager::CONNECTOMICS_WARNING_INFO_NETWORK_CREATED, MBI_INFO, mitk::New(), and mitk::ConnectomicsNetwork::New().

void mitk::ConnectomicsNetworkCreator::CreateNewNode ( int  label,
itk::Index< 3 >  index,
bool  useIndex 
)
protected

Creates a new node.

A new node will be created, using the label and either the supplied coordinates or the center of mass coordinates, depending on the supplied bool.

Definition at line 835 of file mitkConnectomicsNetworkCreator.cpp.

References mitk::ConnectomicsNetwork::NetworkNode::coordinates, and mitk::ConnectomicsNetwork::NetworkNode::label.

mitk::ConnectomicsNetworkCreator::ImageLabelPairType mitk::ConnectomicsNetworkCreator::EndElementPositionLabel ( TractType::Pointer  singleTract)
protected

Use the position of the end and starting element only to map to labels

Map a fiber to a vertex by taking the value of the parcellation image at the same world coordinates as the last and first element of the tract.

Definition at line 226 of file mitkConnectomicsNetworkCreator.cpp.

References mitk::ConnectomicsConstantsManager::CONNECTOMICS_ERROR_INVALID_DIMENSION_NEED_3, and MBI_ERROR.

mitk::ConnectomicsNetworkCreator::ImageLabelPairType mitk::ConnectomicsNetworkCreator::EndElementPositionLabelAvoidingWhiteMatter ( TractType::Pointer  singleTract)
protected

Use the position of the end and starting element unless it is in white matter, then search for nearby parcellation to map to labels

Map a fiber to a vertex by taking the value of the parcellation image at the same world coordinates as the last and first element of the tract. If this happens to be white matter, then try to extend the fiber in a line and take the first non-white matter parcel, that is intersected.

Definition at line 276 of file mitkConnectomicsNetworkCreator.cpp.

References mitk::ConnectomicsConstantsManager::CONNECTOMICS_ERROR_INVALID_DIMENSION_NEED_3, and MBI_ERROR.

void mitk::ConnectomicsNetworkCreator::FiberToSegmentationCoords ( mitk::Point3D fiberCoord,
mitk::Point3D segCoord 
)
protected

Convert fiber index to segmentation index coordinates

Definition at line 463 of file mitkConnectomicsNetworkCreator.cpp.

std::vector< double > mitk::ConnectomicsNetworkCreator::GetCenterOfMass ( int  label)
protected

Get the location of the center of mass for a specific label This can throw an exception if the label is not found.

Definition at line 820 of file mitkConnectomicsNetworkCreator.cpp.

References MITK_ERROR.

itk::Point< float, 3 > mitk::ConnectomicsNetworkCreator::GetItkPoint ( double  point[3])
protected

Convert point to itk point

Definition at line 83 of file mitkConnectomicsNetworkCreator.cpp.

mitk::ConnectomicsNetwork::Pointer mitk::ConnectomicsNetworkCreator::GetNetwork ( )

Definition at line 458 of file mitkConnectomicsNetworkCreator.cpp.

bool mitk::ConnectomicsNetworkCreator::IsBackgroundLabel ( int  labelInQuestion)
protected

Check whether the label in question belongs to background according to the freesurfer table

Definition at line 498 of file mitkConnectomicsNetworkCreator.cpp.

bool mitk::ConnectomicsNetworkCreator::IsNonWhiteMatterLabel ( int  labelInQuestion)
protected

Check whether the label in question belongs to white matter according to the freesurfer table

Definition at line 481 of file mitkConnectomicsNetworkCreator.cpp.

mitk::ConnectomicsNetworkCreator::ImageLabelPairType mitk::ConnectomicsNetworkCreator::JustEndPointVerticesNoLabelTest ( TractType::Pointer  singleTract)
protected

Use the position of the end and starting element only to map to labels

Just take first and last position, no labelling, nothing

Definition at line 395 of file mitkConnectomicsNetworkCreator.cpp.

References mitk::ConnectomicsConstantsManager::CONNECTOMICS_ERROR_INVALID_DIMENSION_NEED_3, and MBI_ERROR.

std::string mitk::ConnectomicsNetworkCreator::LabelToString ( ImageLabelType label)
protected

Create a string from the label

Definition at line 448 of file mitkConnectomicsNetworkCreator.cpp.

void mitk::ConnectomicsNetworkCreator::LinearExtensionUntilGreyMatter ( std::vector< int > &  indexVectorOfPointsToUse,
TractType::Pointer  singleTract,
int &  label,
itk::Index< 3 > &  mitkIndex 
)
protected
mitk::ConnectomicsNetworkCreator::mitkClassMacroItkParent ( ConnectomicsNetworkCreator  ,
itk::Object   
)

Standard class typedefs. Method for creation through the object factory.

static Pointer mitk::ConnectomicsNetworkCreator::New ( )
static

Referenced by main().

mitk::ConnectomicsNetworkCreator::ImageLabelPairType mitk::ConnectomicsNetworkCreator::PrecomputeVertexLocationsBySegmentation ( TractType::Pointer  singleTract)
protected

Map by distance between elements and vertices depending on their volume

First go through the parcellation and compute the coordinates of the future vertices. Assign a radius according on their volume. Then map an edge to a label by considering the nearest vertices and comparing the distance to them to their radii.

Definition at line 269 of file mitkConnectomicsNetworkCreator.cpp.

void mitk::ConnectomicsNetworkCreator::RetractionUntilBrainMatter ( bool  retractFront,
TractType::Pointer  singleTract,
int &  label,
itk::Index< 3 > &  mitkIndex 
)
protected

Retract fiber until the first brain matter label is hit

The bool parameter controls whether the front or the end is retracted

Definition at line 632 of file mitkConnectomicsNetworkCreator.cpp.

mitk::ConnectomicsNetworkCreator::VertexType mitk::ConnectomicsNetworkCreator::ReturnAssociatedVertexForLabel ( ImageLabelType  label)
protected

Determine if a label is already identified with a vertex, otherwise create a new one

Definition at line 169 of file mitkConnectomicsNetworkCreator.cpp.

mitk::ConnectomicsNetworkCreator::ConnectionType mitk::ConnectomicsNetworkCreator::ReturnAssociatedVertexPairForLabelPair ( ImageLabelPairType  labelpair)
protected

Return the vertexes associated with a pair of labels

Definition at line 190 of file mitkConnectomicsNetworkCreator.cpp.

mitk::ConnectomicsNetworkCreator::ImageLabelPairType mitk::ConnectomicsNetworkCreator::ReturnLabelForFiberTract ( TractType::Pointer  singleTract,
MappingStrategy  strategy 
)
protected

Return the pair of labels which identify the areas connected by a single fiber

Definition at line 198 of file mitkConnectomicsNetworkCreator.cpp.

References mitk::ConnectomicsConstantsManager::CONNECTOMICS_ERROR_INVALID_MAPPING, and MBI_ERROR.

void mitk::ConnectomicsNetworkCreator::SegmentationToFiberCoords ( mitk::Point3D segCoord,
mitk::Point3D fiberCoord 
)
protected

Convert segmentation index to fiber index coordinates

Definition at line 472 of file mitkConnectomicsNetworkCreator.cpp.

virtual void mitk::ConnectomicsNetworkCreator::SetEndPointSearchRadius ( double  _arg)
virtual
void mitk::ConnectomicsNetworkCreator::SetFiberBundle ( mitk::FiberBundle::Pointer  fiberBundle)

Definition at line 72 of file mitkConnectomicsNetworkCreator.cpp.

virtual void mitk::ConnectomicsNetworkCreator::SetMappingStrategy ( MappingStrategy  _arg)
virtual
void mitk::ConnectomicsNetworkCreator::SetSegmentation ( mitk::Image::Pointer  segmentation)

Definition at line 77 of file mitkConnectomicsNetworkCreator.cpp.

References mitk::CastToItkImage().

virtual void mitk::ConnectomicsNetworkCreator::SetZeroLabelInvalid ( bool  _arg)
virtual
void mitk::ConnectomicsNetworkCreator::SupplyVertexWithInformation ( ImageLabelType label,
VertexType vertex 
)
protected

Assign the additional information which should be part of the vertex

Definition at line 438 of file mitkConnectomicsNetworkCreator.cpp.

Member Data Documentation

bool mitk::ConnectomicsNetworkCreator::allowLoops
protected

Definition at line 211 of file mitkConnectomicsNetworkCreator.h.

const int mitk::ConnectomicsNetworkCreator::freesurfer_Brain_Stem
staticprotected

Definition at line 239 of file mitkConnectomicsNetworkCreator.h.

const int mitk::ConnectomicsNetworkCreator::freesurfer_Left_Cerebellum_Cortex
staticprotected

Definition at line 238 of file mitkConnectomicsNetworkCreator.h.

const int mitk::ConnectomicsNetworkCreator::freesurfer_Left_Cerebellum_White_Matter
staticprotected

Definition at line 237 of file mitkConnectomicsNetworkCreator.h.

const int mitk::ConnectomicsNetworkCreator::freesurfer_Left_Cerebral_White_Matter
staticprotected

Definition at line 236 of file mitkConnectomicsNetworkCreator.h.

const int mitk::ConnectomicsNetworkCreator::freesurfer_Right_Cerebellum_Cortex
staticprotected

Definition at line 242 of file mitkConnectomicsNetworkCreator.h.

const int mitk::ConnectomicsNetworkCreator::freesurfer_Right_Cerebellum_White_Matter
staticprotected

Definition at line 241 of file mitkConnectomicsNetworkCreator.h.

const int mitk::ConnectomicsNetworkCreator::freesurfer_Right_Cerebral_White_Matter
staticprotected

Definition at line 240 of file mitkConnectomicsNetworkCreator.h.

int mitk::ConnectomicsNetworkCreator::idCounter
protected

Definition at line 202 of file mitkConnectomicsNetworkCreator.h.

bool mitk::ConnectomicsNetworkCreator::m_AbortConnection
protected

Definition at line 230 of file mitkConnectomicsNetworkCreator.h.

mitk::ConnectomicsNetwork::Pointer mitk::ConnectomicsNetworkCreator::m_ConNetwork
protected

Definition at line 199 of file mitkConnectomicsNetworkCreator.h.

double mitk::ConnectomicsNetworkCreator::m_EndPointSearchRadius
protected

Definition at line 223 of file mitkConnectomicsNetworkCreator.h.

mitk::FiberBundle::Pointer mitk::ConnectomicsNetworkCreator::m_FiberBundle
protected

Definition at line 194 of file mitkConnectomicsNetworkCreator.h.

std::map< int, std::vector< double> > mitk::ConnectomicsNetworkCreator::m_LabelsToCoordinatesMap
protected

Definition at line 217 of file mitkConnectomicsNetworkCreator.h.

std::map< ImageLabelType, NetworkNode > mitk::ConnectomicsNetworkCreator::m_LabelToNodePropertyMap
protected

Definition at line 208 of file mitkConnectomicsNetworkCreator.h.

std::map< ImageLabelType, VertexType > mitk::ConnectomicsNetworkCreator::m_LabelToVertexMap
protected

Definition at line 205 of file mitkConnectomicsNetworkCreator.h.

MappingStrategy mitk::ConnectomicsNetworkCreator::m_MappingStrategy
protected

Definition at line 220 of file mitkConnectomicsNetworkCreator.h.

mitk::Image::Pointer mitk::ConnectomicsNetworkCreator::m_Segmentation
protected

Definition at line 195 of file mitkConnectomicsNetworkCreator.h.

ITKImageType::Pointer mitk::ConnectomicsNetworkCreator::m_SegmentationItk
protected

Definition at line 196 of file mitkConnectomicsNetworkCreator.h.

Referenced by ConnectomicsNetworkCreator().

bool mitk::ConnectomicsNetworkCreator::m_UseCoMCoordinates
protected

Definition at line 214 of file mitkConnectomicsNetworkCreator.h.

bool mitk::ConnectomicsNetworkCreator::m_ZeroLabelInvalid
protected

Definition at line 226 of file mitkConnectomicsNetworkCreator.h.


The documentation for this class was generated from the following files: