DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
itkFiberTractsReader.h
Go to the documentation of this file.
1 
11 #ifndef __itkFiberTractsReader_h
12 #define __itkFiberTractsReader_h
13 
14 #include <itkLightProcessObject.h>
15 
16 #include "itkFiberTracts.h"
17 #include "utlCoreMacro.h"
18 
19 namespace itk
20 {
21 
22 class ITK_EXPORT FiberTractsReader : public LightProcessObject
23 {
24 public:
27  typedef LightProcessObject Superclass;
28  typedef SmartPointer<Self> Pointer;
29 
31  itkNewMacro(Self);
32 
34  itkTypeMacro(FiberTractsReader, LightProcessObject);
35 
42 
43  itkSetGetMacro(FileName, std::string);
44  // itkSetGetMacro(FiberTracts, FiberTractsPointer);
45 
47  virtual void Update();
48 
49  void ReadTractsTRK();
50 
51  void ReadTractsTCK();
52 
53  void ReadTractsVTK();
54 
55  FiberTractsPointer GetOutput() const
56  {
57  return m_FiberTracts;
58  }
59 
60 protected:
63 
64  void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE
65  {
66  Superclass::PrintSelf(os, indent);
67  PrintVar(true, os<< indent, m_FileName);
68  m_FiberTracts->Print(os, indent);
69  }
70 
71  std::string m_FileName;
72 
73  FiberTractsPointer m_FiberTracts = FiberTractsType::New();
74 
75 
76 private:
77  FiberTractsReader(const Self&); //purposely not implemented
78  void operator=(const Self&); //purposely not implemented
79 
80 };
81 
82 inline bool
83 ReadFibers (const std::string& filename, SmartPointer<FiberTracts<double> >& fibers, const std::string& printInfo="Reading fibers:")
84 {
86  reader->SetFileName(filename);
87  try
88  {
89  if (utl::IsLogNormal())
90  std::cout << printInfo << " " << filename << std::endl;
91  reader->Update();
92  }
93  catch (itk::ExceptionObject & err)
94  {
95  std::cout << "ExceptionObject caught !" << std::endl;
96  std::cout << err << std::endl;
97  return false;
98  }
99  fibers = reader->GetOutput();
100  return true;
101 }
102 
103 }
104 
105 #ifndef ITK_MANUAL_INSTANTIATION
106 #include "itkFiberTractsReader.hxx"
107 #endif
108 
109 
110 #endif
FiberType::Pointer FiberPointer
SmartPointer< Self > Pointer
TractType::VertexType VertexType
Definition: itkFiber.h:44
FiberTracts< double > FiberTractsType
FiberTractsType::FiberPointer FiberPointer
FiberTractsType::FiberType FiberType
static Pointer New()
LightProcessObject Superclass
#define ITK_OVERRIDE
Definition: utlITKMacro.h:46
FiberTractsPointer GetOutput() const
FiberTractsType::Pointer FiberTractsPointer
void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE
bool IsLogNormal(const int level=utl::LogLevel)
Definition: utlCoreMacro.h:209
Created "08-23-2017.
#define PrintVar(cond, os,...)
Definition: utlCoreMacro.h:242
std::vector< ValueType > STDVectorType
Definition: itkFiber.h:46
bool ReadFibers(const std::string &filename, SmartPointer< FiberTracts< double > > &fibers, const std::string &printInfo="Reading fibers:")
FiberType::VertexType VertexType
#define itkSetGetMacro(name, type)
Definition: utlITKMacro.h:134
FiberType::STDVectorType STDVectorType
Created "07-22-2017.
macros for utlCore
SmartPointer< Self > Pointer