ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itk::TrxParcellationLabeler Class Reference

#include <itkTrxParcellationLabeler.h>

Detailed Description

Assigns streamlines to TRX groups based on brain parcellation images.

Reads one or more NIfTI-1 label images (parcellations), performs a single sequential pass over all streamline coordinates in LPS space, and records which streamlines intersect which region voxels. Results are written as named groups in a new TRX file that preserves all existing DPS and DPV fields from the input.

A streamline is assigned to a region group when any of its coordinates falls inside a voxel bearing that region's integer label. The check is whole-streamline (endpoints are not treated specially).

Usage

labeler->SetInput(streamlineData);
labeler->SetOutputFileName("labeled.trx");
glasser.niftiPath = "seg-Glasser_dseg.nii.gz";
glasser.labelFilePath = "seg-Glasser_dseg.txt";
glasser.groupPrefix = "Glasser";
labeler->AddParcellation(glasser);
labeler->SetDilationRadius(1); // optional: expand each region by 1 voxel
labeler->Update();

Group naming

Groups are named {prefix}_{label_name}, e.g. Glasser_Left_V1. Pre-existing groups in the input TRX are preserved in the output.

Coordinate system

All computation is performed in ITK's LPS physical coordinate system. NIfTI images are read via itk::ImageFileReader, which delivers images in LPS automatically. The TRX coordinate conversion is handled internally by TrxStreamlineData::ForEachStreamlineChunked. Callers need not be aware of the TRX-internal RAS representation.

Definition at line 79 of file itkTrxParcellationLabeler.h.

+ Inheritance diagram for itk::TrxParcellationLabeler:
+ Collaboration diagram for itk::TrxParcellationLabeler:

Classes

struct  ParcellationSpec
 

Public Types

using ConstPointer = SmartPointer<const Self>
 
using Pointer = SmartPointer<Self>
 
using Self = TrxParcellationLabeler
 
using Superclass = Object
 
- Public Types inherited from itk::Object
using ConstPointer = SmartPointer<const Self>
 
using Pointer = SmartPointer<Self>
 
using Self = Object
 
using Superclass = LightObject
 
- Public Types inherited from itk::LightObject
using ConstPointer = SmartPointer<const Self>
 
using Pointer = SmartPointer<Self>
 
using Self = LightObject
 

Public Member Functions

void AddParcellation (const ParcellationSpec &spec)
 
virtual::itk::LightObject::Pointer CreateAnother () const
 
virtual unsigned int GetDilationRadius () const
 
vcl_size_t GetFinalFileBytes () const
 
const std::string & GetInputFileName () const
 
virtual vcl_size_t GetMaxDpvBytes () const
 
virtual const char * GetNameOfClass () const
 
const std::string & GetOutputFileName () const
 
vcl_size_t GetPreGroupFileBytes () const
 
virtual void SetDilationRadius (unsigned int _arg)
 
void SetInput (TrxStreamlineData::ConstPointer input)
 
void SetInputFileName (const std::string &filename)
 
virtual void SetMaxDpvBytes (vcl_size_t _arg)
 
void SetOutputFileName (const std::string &filename)
 
void Update ()
 
- Public Member Functions inherited from itk::Object
unsigned long AddObserver (const EventObject &event, Command *cmd) const
 
unsigned long AddObserver (const EventObject &event, std::function< void(const EventObject &)> function) const
 
virtual void DebugOff () const
 
virtual void DebugOn () const
 
Command * GetCommand (unsigned long tag)
 
bool GetDebug () const
 
MetaDataDictionary & GetMetaDataDictionary ()
 
const MetaDataDictionary & GetMetaDataDictionary () const
 
virtual ModifiedTimeType GetMTime () const
 
virtual const TimeStamp & GetTimeStamp () const
 
bool HasObserver (const EventObject &event) const
 
void InvokeEvent (const EventObject &)
 
void InvokeEvent (const EventObject &) const
 
virtual void Modified () const
 
void Register () const override
 
void RemoveAllObservers ()
 
void RemoveObserver (unsigned long tag) const
 
void SetDebug (bool debugFlag) const
 
void SetReferenceCount (int) override
 
void UnRegister () const noexcept override
 
void SetMetaDataDictionary (const MetaDataDictionary &rhs)
 
void SetMetaDataDictionary (MetaDataDictionary &&rrhs)
 
virtual void SetObjectName (std::string _arg)
 
virtual const std::string & GetObjectName () const
 
- Public Member Functions inherited from itk::LightObject
Pointer Clone () const
 
virtual void Delete ()
 
virtual int GetReferenceCount () const
 
void Print (std::ostream &os, Indent indent=0) const
 

Static Public Member Functions

static Pointer New ()
 
- Static Public Member Functions inherited from itk::Object
static bool GetGlobalWarningDisplay ()
 
static void GlobalWarningDisplayOff ()
 
static void GlobalWarningDisplayOn ()
 
static Pointer New ()
 
static void SetGlobalWarningDisplay (bool val)
 
- Static Public Member Functions inherited from itk::LightObject
static void BreakOnError ()
 
static Pointer New ()
 

Protected Member Functions

void PrintSelf (std::ostream &os, Indent indent) const override
 
 TrxParcellationLabeler ()=default
 
 ~TrxParcellationLabeler () override=default
 
- Protected Member Functions inherited from itk::Object
 Object ()
 
bool PrintObservers (std::ostream &os, Indent indent) const
 
virtual void SetTimeStamp (const TimeStamp &timeStamp)
 
 ~Object () override
 
- Protected Member Functions inherited from itk::LightObject
virtual LightObject::Pointer InternalClone () const
 
 LightObject ()
 
virtual void PrintHeader (std::ostream &os, Indent indent) const
 
virtual void PrintTrailer (std::ostream &os, Indent indent) const
 
virtual ~LightObject ()
 

Private Attributes

unsigned int m_DilationRadius { 0 }
 
vcl_size_t m_FinalFileBytes { 0 }
 
TrxStreamlineData::ConstPointer m_Input
 
std::string m_InputFileName
 
vcl_size_t m_MaxDpvBytes { 512ULL * 1024ULL * 1024ULL }
 
std::string m_OutputFileName
 
std::vector< ParcellationSpec > m_Parcellations
 
vcl_size_t m_PreGroupFileBytes { 0 }
 

Additional Inherited Members

- Protected Attributes inherited from itk::LightObject
std::atomic< int > m_ReferenceCount {}
 

Member Typedef Documentation

◆ ConstPointer

◆ Pointer

◆ Self

◆ Superclass

Constructor & Destructor Documentation

◆ TrxParcellationLabeler()

itk::TrxParcellationLabeler::TrxParcellationLabeler ( )
protecteddefault

Referenced by GetNameOfClass().

◆ ~TrxParcellationLabeler()

itk::TrxParcellationLabeler::~TrxParcellationLabeler ( )
overrideprotecteddefault

Member Function Documentation

◆ AddParcellation()

void itk::TrxParcellationLabeler::AddParcellation ( const ParcellationSpec & spec)

Add a parcellation atlas. May be called multiple times.

◆ CreateAnother()

virtual::itk::LightObject::Pointer itk::TrxParcellationLabeler::CreateAnother ( ) const
virtual

Create an object from an instance, potentially deferring to a factory. This method allows you to create an instance of an object that is exactly the same type as the referring object. This is useful in cases where an object has been cast back to a base class.

Reimplemented from itk::Object.

◆ GetDilationRadius()

virtual unsigned int itk::TrxParcellationLabeler::GetDilationRadius ( ) const
virtual

◆ GetFinalFileBytes()

vcl_size_t itk::TrxParcellationLabeler::GetFinalFileBytes ( ) const

Bytes in output artifact after group append (final output).

◆ GetInputFileName()

const std::string & itk::TrxParcellationLabeler::GetInputFileName ( ) const

◆ GetMaxDpvBytes()

virtual vcl_size_t itk::TrxParcellationLabeler::GetMaxDpvBytes ( ) const
virtual

◆ GetNameOfClass()

virtual const char * itk::TrxParcellationLabeler::GetNameOfClass ( ) const
virtual
See also
LightObject::GetNameOfClass()

Reimplemented from itk::Object.

References TrxParcellationLabeler().

◆ GetOutputFileName()

const std::string & itk::TrxParcellationLabeler::GetOutputFileName ( ) const

◆ GetPreGroupFileBytes()

vcl_size_t itk::TrxParcellationLabeler::GetPreGroupFileBytes ( ) const

Bytes in output artifact immediately before group append.

◆ New()

static Pointer itk::TrxParcellationLabeler::New ( )
static

◆ PrintSelf()

void itk::TrxParcellationLabeler::PrintSelf ( std::ostream & os,
Indent indent ) const
overrideprotectedvirtual

Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from itk::Object.

◆ SetDilationRadius()

virtual void itk::TrxParcellationLabeler::SetDilationRadius ( unsigned int _arg)
virtual

Morphological dilation radius applied to each label image before lookup, measured in voxels. A ball-shaped structuring element is used. Set to 0 (default) to skip dilation. Dilation uses a grayscale max-value rule, which expands each label into adjacent background voxels; at region boundaries the higher label value wins.

◆ SetInput()

void itk::TrxParcellationLabeler::SetInput ( TrxStreamlineData::ConstPointer input)

Set the source streamline data.

◆ SetInputFileName()

void itk::TrxParcellationLabeler::SetInputFileName ( const std::string & filename)

Optional path to the source TRX artifact used for copy-through output.

When set, Update() will copy this source artifact to OutputFileName and append computed groups in-place, preserving original coordinate dtype and payload encoding.

If unset, Update() falls back to full rewrite mode.

◆ SetMaxDpvBytes()

virtual void itk::TrxParcellationLabeler::SetMaxDpvBytes ( vcl_size_t _arg)
virtual

Maximum bytes of DPV data to load per field. Fields whose total byte size exceeds this limit are skipped with a warning rather than copied. Default: 512 MiB.

◆ SetOutputFileName()

void itk::TrxParcellationLabeler::SetOutputFileName ( const std::string & filename)

Set the output TRX file path. A ".trx" extension produces a zip archive; any other extension (or no extension) produces an uncompressed directory.

◆ Update()

void itk::TrxParcellationLabeler::Update ( )

Run labeling and write the output TRX file.

Member Data Documentation

◆ m_DilationRadius

unsigned int itk::TrxParcellationLabeler::m_DilationRadius { 0 }
private

Definition at line 185 of file itkTrxParcellationLabeler.h.

◆ m_FinalFileBytes

vcl_size_t itk::TrxParcellationLabeler::m_FinalFileBytes { 0 }
private

Definition at line 188 of file itkTrxParcellationLabeler.h.

◆ m_Input

TrxStreamlineData::ConstPointer itk::TrxParcellationLabeler::m_Input
private

Definition at line 181 of file itkTrxParcellationLabeler.h.

◆ m_InputFileName

std::string itk::TrxParcellationLabeler::m_InputFileName
private

Definition at line 182 of file itkTrxParcellationLabeler.h.

◆ m_MaxDpvBytes

vcl_size_t itk::TrxParcellationLabeler::m_MaxDpvBytes { 512ULL * 1024ULL * 1024ULL }
private

Definition at line 186 of file itkTrxParcellationLabeler.h.

◆ m_OutputFileName

std::string itk::TrxParcellationLabeler::m_OutputFileName
private

Definition at line 184 of file itkTrxParcellationLabeler.h.

◆ m_Parcellations

std::vector<ParcellationSpec> itk::TrxParcellationLabeler::m_Parcellations
private

Definition at line 183 of file itkTrxParcellationLabeler.h.

◆ m_PreGroupFileBytes

vcl_size_t itk::TrxParcellationLabeler::m_PreGroupFileBytes { 0 }
private

Definition at line 187 of file itkTrxParcellationLabeler.h.


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