#include <itkTrxStreamlineData.h>
Central data container for TRX tractography files.
Holds lazy-loaded streamline positions (Float16/32/64) and per-streamline offsets. Positions are stored as a contiguous array of XYZ triplets; offsets define the start index of each streamline and include a sentinel at the end.
Supports AABB spatial queries, lazy/eager subsetting, chunked iteration, zero-copy views, named group access (GetGroupNames(), GetGroup()), DPS/DPV field enumeration, and connectivity matrix computation between groups.
Definition at line 61 of file itkTrxStreamlineData.h.
Inheritance diagram for itk::TrxStreamlineData:
Collaboration diagram for itk::TrxStreamlineData:Classes | |
| struct | GroupConnectivityResult |
| class | StreamlinePointRange |
| struct | StreamlineView |
Public Member Functions | |
| GroupConnectivityResult | ComputeGroupConnectivity (const std::string &dpsFieldName="") const |
| virtual::itk::LightObject::Pointer | CreateAnother () const |
| void | FlipXYInPlace () |
| void | ForEachStreamlineChunked (const std::function< void(SizeValueType, const void *, SizeValueType, CoordinateType, CoordinateSystem)> &fn, CoordinateSystem requestedSystem=CoordinateSystem::LPS) const |
| CoordinateSystem | GetCoordinateSystem () const |
| CoordinateType | GetCoordinateType () const |
| const DimensionsType & | GetDimensions () const |
| std::vector< float > | GetDpsField (const std::string &name) const |
| std::vector< std::string > | GetDpsFieldNames () const |
| std::vector< float > | GetDpvField (const std::string &name) const |
| std::vector< std::string > | GetDpvFieldNames () const |
| std::vector< Eigen::half > * | GetFloat16Positions () |
| const std::vector< Eigen::half > * | GetFloat16Positions () const |
| std::vector< float > * | GetFloat32Positions () |
| const std::vector< float > * | GetFloat32Positions () const |
| std::vector< double > * | GetFloat64Positions () |
| const std::vector< double > * | GetFloat64Positions () const |
| TrxGroup::Pointer | GetGroup (const std::string &name) const |
| std::vector< std::string > | GetGroupNames () const |
| SizeValueType | GetGroupStreamlineCount (const std::string &name) const |
| virtual const char * | GetNameOfClass () const |
| SizeValueType | GetNumberOfStreamlines () const |
| SizeValueType | GetNumberOfVertices () const |
| const std::vector< OffsetType > & | GetOffsets () const |
| const std::vector< AabbType > & | GetOrBuildStreamlineAabbs () const |
| std::vector< PointType > | GetStreamline (SizeValueType streamlineIndex) const |
| StreamlinePointRange | GetStreamlineRange (SizeValueType streamlineIndex) const |
| bool | GetStreamlineView (SizeValueType streamlineIndex, StreamlineView &view) const |
| const MatrixType & | GetVoxelToLpsMatrix () const |
| const MatrixType & | GetVoxelToRasMatrix () const |
| void | Graft (const DataObject *data) override |
| bool | HasDimensions () const |
| bool | HasFloat16Positions () const |
| bool | HasFloat32Positions () const |
| bool | HasFloat64Positions () const |
| bool | HasGroups () const |
| bool | HasTrxHandle () const |
| bool | HasVoxelToLpsMatrix () const |
| bool | HasVoxelToRasMatrix () const |
| void | InvalidateAabbCache () const |
| Pointer | QueryAabb (const PointType &minCornerLps, const PointType &maxCornerLps, bool buildCacheForResult, vcl_size_t maxStreamlines, uint32_t rngSeed) const |
| Pointer | QueryAabb (const PointType &minCornerLps, const PointType &maxCornerLps, bool buildCacheForResult=false) const |
| void | Save (const std::string &filename, bool useCompression) const |
| void | SetCoordinateSystem (CoordinateSystem system) |
| void | SetDimensions (const DimensionsType &dims) |
| void | SetOffsets (std::vector< OffsetType > &&offsets) |
| void | SetTrxHandle (const std::shared_ptr< TrxHandleBase > &trxHandle) |
| void | SetVoxelToLpsMatrix (const MatrixType &matrix) |
| void | SetVoxelToRasMatrix (const MatrixType &matrix) |
| Pointer | SubsetStreamlines (const std::vector< uint32_t > &streamlineIds, bool buildCacheForResult=false) const |
| Pointer | SubsetStreamlinesLazy (const std::vector< uint32_t > &streamlineIds, bool buildCacheForResult=false) const |
| template<typename TTransform> | |
| void | TransformInPlace (const TTransform *transform) |
| template<typename TTransform> | |
| void | TransformInPlaceChunked (const TTransform *transform, SizeValueType chunkPoints) |
| template<typename TTransform> | |
| void | TransformToWriterChunked (const TTransform *transform, class TrxStreamWriter *writer, SizeValueType reservePoints=0) const |
| template<typename TTransform> | |
| void | TransformToWriterChunkedReuseBuffer (const TTransform *transform, class TrxStreamWriter *writer, StreamlineType &buffer, SizeValueType reservePoints=0) const |
| template<typename TTransform> | |
| void | TransformToWriterChunkedReuseVnlBuffer (const TTransform *transform, class TrxStreamWriter *writer, vnl_matrix< double > &buffer) const |
Public Member Functions inherited from itk::DataObject | |
| virtual void | CopyInformation (const DataObject *) |
| virtual void | DataHasBeenGenerated () |
| void | DisconnectPipeline () |
| bool | GetDataReleased () const |
| virtual const bool & | GetReleaseDataFlag () const |
| SmartPointer< ProcessObject > | GetSource () const |
| DataObjectPointerArraySizeType | GetSourceOutputIndex () const |
| const DataObjectIdentifierType & | GetSourceOutputName () const |
| virtual ModifiedTimeType | GetUpdateMTime () const |
| virtual void | Initialize () |
| virtual void | PrepareForNewData () |
| virtual void | PropagateRequestedRegion () |
| void | ReleaseData () |
| virtual void | ReleaseDataFlagOff () |
| virtual void | ReleaseDataFlagOn () |
| virtual bool | RequestedRegionIsOutsideOfTheBufferedRegion () |
| virtual void | ResetPipeline () |
| void | SetReleaseDataFlag (bool flag) |
| virtual void | SetRequestedRegion (const DataObject *) |
| virtual void | SetRequestedRegionToLargestPossibleRegion () |
| bool | ShouldIReleaseData () const |
| virtual void | Update () |
| virtual void | UpdateOutputData () |
| virtual void | UpdateOutputInformation () |
| void | UpdateSource () const |
| virtual bool | VerifyRequestedRegion () |
| void | SetPipelineMTime (ModifiedTimeType time) |
| virtual const ModifiedTimeType & | GetPipelineMTime () const |
| virtual void | SetRealTimeStamp (RealTimeStamp _arg) |
| virtual const RealTimeStamp & | GetRealTimeStamp () const |
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::DataObject | |
| static bool | GetGlobalReleaseDataFlag () |
| static void | GlobalReleaseDataFlagOff () |
| static void | GlobalReleaseDataFlagOn () |
| static Pointer | New () |
| static void | SetGlobalReleaseDataFlag (bool val) |
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 |
| TrxStreamlineData ()=default | |
| ~TrxStreamlineData () override=default | |
Protected Member Functions inherited from itk::DataObject | |
| DataObject () | |
| virtual void | PropagateResetPipeline () |
| ~DataObject () override | |
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 Types | |
| using | PositionStorageType = std::variant<std::vector<Eigen::half>, std::vector<float>, std::vector<double>> |
Private Member Functions | |
| void | EnsureOffsetsSentinel () |
| void | EnsurePositionsLoaded () const |
| PointType | GetPointLpsAtIndex (SizeValueType index) const |
Private Attributes | |
| std::vector< AabbType > | m_AabbCache |
| bool | m_AabbCacheValid { false } |
| CoordinateSystem | m_CoordinateSystem { CoordinateSystem::RAS } |
| DimensionsType | m_Dimensions { { 0, 0, 0 } } |
| std::vector< std::string > | m_DpsFieldNames |
| std::vector< std::string > | m_DpvFieldNames |
| CoordinateType | m_FileCoordinateType { CoordinateType::Float32 } |
| std::map< std::string, TrxGroup::Pointer > | m_GroupCache |
| std::vector< std::string > | m_GroupNames |
| bool | m_HasDimensions { false } |
| bool | m_HasVoxelToLps { false } |
| bool | m_HasVoxelToRas { false } |
| SizeValueType | m_NumberOfVertices { 0 } |
| std::vector< OffsetType > | m_Offsets |
| PositionStorageType | m_Positions |
| bool | m_PositionsLoaded { true } |
| std::shared_ptr< TrxHandleBase > | m_TrxHandle |
| MatrixType | m_VoxelToLpsMatrix {} |
| MatrixType | m_VoxelToRasMatrix {} |
Additional Inherited Members | |
Protected Attributes inherited from itk::LightObject | |
| std::atomic< int > | m_ReferenceCount {} |
| using itk::TrxStreamlineData::AabbType = std::array<double, 6> |
Definition at line 93 of file itkTrxStreamlineData.h.
| using itk::TrxStreamlineData::ConstPointer = SmartPointer<const Self> |
Definition at line 69 of file itkTrxStreamlineData.h.
| using itk::TrxStreamlineData::DimensionsType = FixedArray<uint16_t, 3> |
Definition at line 90 of file itkTrxStreamlineData.h.
| using itk::TrxStreamlineData::MatrixType = Matrix<double, 4, 4> |
Definition at line 89 of file itkTrxStreamlineData.h.
| using itk::TrxStreamlineData::OffsetType = uint64_t |
Definition at line 87 of file itkTrxStreamlineData.h.
Definition at line 68 of file itkTrxStreamlineData.h.
| using itk::TrxStreamlineData::PointType = itk::Point<double, 3> |
Definition at line 91 of file itkTrxStreamlineData.h.
|
private |
Definition at line 418 of file itkTrxStreamlineData.h.
Definition at line 66 of file itkTrxStreamlineData.h.
Definition at line 88 of file itkTrxStreamlineData.h.
| using itk::TrxStreamlineData::StreamlineType = std::vector<PointType> |
Definition at line 92 of file itkTrxStreamlineData.h.
Definition at line 67 of file itkTrxStreamlineData.h.
|
strong |
| Enumerator | |
|---|---|
| RAS | |
| LPS | |
Definition at line 81 of file itkTrxStreamlineData.h.
|
strong |
| Enumerator | |
|---|---|
| Float16 | |
| Float32 | |
| Float64 | |
Definition at line 74 of file itkTrxStreamlineData.h.
|
protecteddefault |
|
overrideprotecteddefault |
| GroupConnectivityResult itk::TrxStreamlineData::ComputeGroupConnectivity | ( | const std::string & | dpsFieldName = "" | ) | const |
Compute group connectivity as either raw streamline counts or weighted sums.
If dpsFieldName is empty, matrix entries are raw streamline counts. If dpsFieldName is provided, matrix entries are sums of that 1D DPS field over streamlines belonging to each group pair.
Diagonal entries represent within-group totals.
|
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.
|
private |
|
private |
| void itk::TrxStreamlineData::FlipXYInPlace | ( | ) |
| void itk::TrxStreamlineData::ForEachStreamlineChunked | ( | const std::function< void(SizeValueType, const void *, SizeValueType, CoordinateType, CoordinateSystem)> & | fn, |
| CoordinateSystem | requestedSystem = CoordinateSystem::LPS ) const |
Iterate streamlines and provide raw XYZ pointers. If requestedSystem is LPS and the backing data is RAS-only, each streamline is converted into a temporary buffer before callback.
References LPS.
| CoordinateSystem itk::TrxStreamlineData::GetCoordinateSystem | ( | ) | const |
| CoordinateType itk::TrxStreamlineData::GetCoordinateType | ( | ) | const |
| const DimensionsType & itk::TrxStreamlineData::GetDimensions | ( | ) | const |
| std::vector< float > itk::TrxStreamlineData::GetDpsField | ( | const std::string & | name | ) | const |
Per-streamline scalar field values, widened to float. For multi-column fields the values are returned flat in row-major order. Returns empty if no handle or field not found.
| std::vector< std::string > itk::TrxStreamlineData::GetDpsFieldNames | ( | ) | const |
Names of all per-streamline scalar fields (DPS).
| std::vector< float > itk::TrxStreamlineData::GetDpvField | ( | const std::string & | name | ) | const |
Per-vertex scalar field values, widened to float. Length equals nVertices * nCols (usually nVertices for scalar fields). Returns empty if no handle or field not found.
| std::vector< std::string > itk::TrxStreamlineData::GetDpvFieldNames | ( | ) | const |
Names of all per-vertex scalar fields (DPV).
| std::vector< Eigen::half > * itk::TrxStreamlineData::GetFloat16Positions | ( | ) |
| const std::vector< Eigen::half > * itk::TrxStreamlineData::GetFloat16Positions | ( | ) | const |
| std::vector< float > * itk::TrxStreamlineData::GetFloat32Positions | ( | ) |
| const std::vector< float > * itk::TrxStreamlineData::GetFloat32Positions | ( | ) | const |
| std::vector< double > * itk::TrxStreamlineData::GetFloat64Positions | ( | ) |
| const std::vector< double > * itk::TrxStreamlineData::GetFloat64Positions | ( | ) | const |
| TrxGroup::Pointer itk::TrxStreamlineData::GetGroup | ( | const std::string & | name | ) | const |
Return a TrxGroup for the named group. The result is cached so repeated calls are O(1). Returns nullptr if no backing handle or name not found.
| std::vector< std::string > itk::TrxStreamlineData::GetGroupNames | ( | ) | const |
Names of all groups in the file (order matches the TRX storage order).
| SizeValueType itk::TrxStreamlineData::GetGroupStreamlineCount | ( | const std::string & | name | ) | const |
Number of streamlines in a named group, or 0 if not found.
|
virtual |
Reimplemented from itk::DataObject.
References TrxStreamlineData().
| SizeValueType itk::TrxStreamlineData::GetNumberOfStreamlines | ( | ) | const |
| SizeValueType itk::TrxStreamlineData::GetNumberOfVertices | ( | ) | const |
| const std::vector< OffsetType > & itk::TrxStreamlineData::GetOffsets | ( | ) | const |
| const std::vector< AabbType > & itk::TrxStreamlineData::GetOrBuildStreamlineAabbs | ( | ) | const |
|
private |
| std::vector< PointType > itk::TrxStreamlineData::GetStreamline | ( | SizeValueType | streamlineIndex | ) | const |
| StreamlinePointRange itk::TrxStreamlineData::GetStreamlineRange | ( | SizeValueType | streamlineIndex | ) | const |
| bool itk::TrxStreamlineData::GetStreamlineView | ( | SizeValueType | streamlineIndex, |
| StreamlineView & | view ) const |
Return a zero-copy view over a streamline when positions are loaded.
| const MatrixType & itk::TrxStreamlineData::GetVoxelToLpsMatrix | ( | ) | const |
| const MatrixType & itk::TrxStreamlineData::GetVoxelToRasMatrix | ( | ) | const |
|
overridevirtual |
Copy internal TRX state without deep copying buffers.
Reimplemented from itk::DataObject.
References itk::DataObject::DataObject().
| bool itk::TrxStreamlineData::HasDimensions | ( | ) | const |
| bool itk::TrxStreamlineData::HasFloat16Positions | ( | ) | const |
| bool itk::TrxStreamlineData::HasFloat32Positions | ( | ) | const |
| bool itk::TrxStreamlineData::HasFloat64Positions | ( | ) | const |
| bool itk::TrxStreamlineData::HasGroups | ( | ) | const |
True if the loaded TRX file contains at least one named group.
| bool itk::TrxStreamlineData::HasTrxHandle | ( | ) | const |
| bool itk::TrxStreamlineData::HasVoxelToLpsMatrix | ( | ) | const |
| bool itk::TrxStreamlineData::HasVoxelToRasMatrix | ( | ) | const |
| void itk::TrxStreamlineData::InvalidateAabbCache | ( | ) | const |
|
static |
|
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::DataObject.
| Pointer itk::TrxStreamlineData::QueryAabb | ( | const PointType & | minCornerLps, |
| const PointType & | maxCornerLps, | ||
| bool | buildCacheForResult, | ||
| vcl_size_t | maxStreamlines, | ||
| uint32_t | rngSeed ) const |
| Pointer itk::TrxStreamlineData::QueryAabb | ( | const PointType & | minCornerLps, |
| const PointType & | maxCornerLps, | ||
| bool | buildCacheForResult = false ) const |
| void itk::TrxStreamlineData::Save | ( | const std::string & | filename, |
| bool | useCompression ) const |
| void itk::TrxStreamlineData::SetCoordinateSystem | ( | CoordinateSystem | system | ) |
| void itk::TrxStreamlineData::SetDimensions | ( | const DimensionsType & | dims | ) |
| void itk::TrxStreamlineData::SetOffsets | ( | std::vector< OffsetType > && | offsets | ) |
| void itk::TrxStreamlineData::SetTrxHandle | ( | const std::shared_ptr< TrxHandleBase > & | trxHandle | ) |
| void itk::TrxStreamlineData::SetVoxelToLpsMatrix | ( | const MatrixType & | matrix | ) |
| void itk::TrxStreamlineData::SetVoxelToRasMatrix | ( | const MatrixType & | matrix | ) |
| Pointer itk::TrxStreamlineData::SubsetStreamlines | ( | const std::vector< uint32_t > & | streamlineIds, |
| bool | buildCacheForResult = false ) const |
| Pointer itk::TrxStreamlineData::SubsetStreamlinesLazy | ( | const std::vector< uint32_t > & | streamlineIds, |
| bool | buildCacheForResult = false ) const |
Return a lazy subset when a TRX backing handle is available. Falls back to the eager subset when no handle is present.
| void itk::TrxStreamlineData::TransformInPlace | ( | const TTransform * | transform | ) |
| void itk::TrxStreamlineData::TransformInPlaceChunked | ( | const TTransform * | transform, |
| SizeValueType | chunkPoints ) |
| void itk::TrxStreamlineData::TransformToWriterChunked | ( | const TTransform * | transform, |
| class TrxStreamWriter * | writer, | ||
| SizeValueType | reservePoints = 0 ) const |
| void itk::TrxStreamlineData::TransformToWriterChunkedReuseBuffer | ( | const TTransform * | transform, |
| class TrxStreamWriter * | writer, | ||
| StreamlineType & | buffer, | ||
| SizeValueType | reservePoints = 0 ) const |
| void itk::TrxStreamlineData::TransformToWriterChunkedReuseVnlBuffer | ( | const TTransform * | transform, |
| class TrxStreamWriter * | writer, | ||
| vnl_matrix< double > & | buffer ) const |
Transform points into a reusable N-by-3 vnl matrix buffer and stream to writer.
|
mutableprivate |
Definition at line 435 of file itkTrxStreamlineData.h.
|
mutableprivate |
Definition at line 436 of file itkTrxStreamlineData.h.
|
private |
Definition at line 444 of file itkTrxStreamlineData.h.
|
private |
Definition at line 440 of file itkTrxStreamlineData.h.
|
private |
Definition at line 448 of file itkTrxStreamlineData.h.
|
private |
Definition at line 449 of file itkTrxStreamlineData.h.
|
private |
Definition at line 432 of file itkTrxStreamlineData.h.
|
mutableprivate |
Definition at line 446 of file itkTrxStreamlineData.h.
|
private |
Definition at line 447 of file itkTrxStreamlineData.h.
|
private |
Definition at line 443 of file itkTrxStreamlineData.h.
|
private |
Definition at line 442 of file itkTrxStreamlineData.h.
|
private |
Definition at line 441 of file itkTrxStreamlineData.h.
|
private |
Definition at line 431 of file itkTrxStreamlineData.h.
|
private |
Definition at line 430 of file itkTrxStreamlineData.h.
|
mutableprivate |
Definition at line 429 of file itkTrxStreamlineData.h.
|
mutableprivate |
Definition at line 434 of file itkTrxStreamlineData.h.
|
private |
Definition at line 433 of file itkTrxStreamlineData.h.
|
private |
Definition at line 439 of file itkTrxStreamlineData.h.
|
private |
Definition at line 438 of file itkTrxStreamlineData.h.