plastimatch
Loading...
Searching...
No Matches
plm_image_header.h
Go to the documentation of this file.
1/* -----------------------------------------------------------------------
2 See COPYRIGHT.TXT and LICENSE.TXT for copyright and license information
3 ----------------------------------------------------------------------- */
4#ifndef _plm_image_header_h_
5#define _plm_image_header_h_
6
7#include "plmbase_config.h"
8#include "direction_cosines.h"
9#include "itk_image.h"
10#include "itk_image_region.h"
11#include "itk_image_origin.h"
12#include "plm_image.h"
13
14class Bspline_xform;
15class Plm_image_header_private;
16class Volume;
17class Volume_header;
18
25public:
26 Plm_image_header_private *d_ptr;
27
28private:
29 OriginType m_origin;
30 SpacingType m_spacing;
31 RegionType m_region;
32 DirectionType m_direction;
33
34public:
36 Plm_image_header (plm_long dim[3], float origin[3], float spacing[3]);
37 Plm_image_header (plm_long dim[3], float origin[3], float spacing[3],
38 float direction_cosines[9]);
39 Plm_image_header (const RegionType& region, const OriginType& origin,
40 const SpacingType& spacing, const DirectionType& direction);
42 Plm_image_header (const Plm_image& pli);
45 Plm_image_header (const Volume::Pointer& vol);
46 Plm_image_header (const Volume& vol);
47 Plm_image_header (const Volume* vol);
49 template<class T> Plm_image_header (T image);
52
53public:
54 const Plm_image_header& operator= (const Plm_image_header&);
55
56public:
57 /* Getters and Setters */
58 int dim (int d) const;
59 float origin (int d) const;
60 float spacing (int d) const;
61 void set_dim (const plm_long dim[3]);
62 void set_origin (const float origin[3]);
63 void set_origin (const OriginType& origin) {
64 m_origin = origin;
65 }
66 void set_spacing (const float spacing[3]);
67 void set_direction_cosines (
68 const float direction_cosines[9]);
69 void set_direction_cosines (
70 const Direction_cosines& dc);
71 void set (const Plm_image_header& src);
72 void set (
73 const plm_long dim[3],
74 const float origin[3],
75 const float spacing[3],
76 const Direction_cosines& dc);
77 void set (
78 const plm_long dim[3],
79 const float origin[3],
80 const float spacing[3],
81 const float direction_cosines[9]);
82 void set_from_gpuit (
83 const plm_long dim[3],
84 const float origin[3],
85 const float spacing[3],
86 const float direction_cosines[9]);
87 void set_from_gpuit_bspline (Bspline_xform *bxf);
88 void set_from_plm_image (const Plm_image *pli);
89 void set_from_plm_image (const Plm_image& pli);
90 void set_from_plm_image (const Plm_image::Pointer& pli);
91 void set_from_volume_header (const Volume_header& vh);
92 void set (const Volume_header& vh);
93 void set (const Volume::Pointer& vol);
94 void set (const Volume& vol);
95 void set (const Volume* vol);
96 void set (const RegionType& region, const OriginType& origin,
97 const SpacingType& spacing, const DirectionType& direction);
98 template<class T> void set_from_itk_image (const T& image);
99 template<class T> void set_from_itk_image (const T* image);
100 const OriginType& GetOrigin () const;
101 const SpacingType& GetSpacing () const;
102 const RegionType& GetRegion () const;
103 const DirectionType& GetDirection () const;
104 const SizeType& GetSize (void) const;
105 void get_volume_header (Volume_header *vh) const;
106 void get_origin (float origin[3]) const;
107 void get_spacing (float spacing[3]) const;
108 void get_dim (plm_long dim[3]) const;
109 void get_direction_cosines (float direction_cosines[9]) const;
110
111 /* Algorithms */
112 static void clone (Plm_image_header *dest, const Plm_image_header *src);
113
117 void expand_to_contain (const FloatPoint3DType& position);
118
122 void set_geometry_to_contain (
123 const Plm_image_header& reference_pih,
124 const Plm_image_header& compare_pih);
125
126 void print (void) const;
127
131 static bool compare (const Plm_image_header *pli1, const Plm_image_header *pli2,
132 float threshold = 1e-5);
133 static bool compare (const Plm_image_header& pli1, const Plm_image_header& pli2,
134 float threshold = 1e-5);
135
136 FloatPoint3DType get_index (const FloatPoint3DType& pos) const;
137 FloatPoint3DType get_position (const float index[3]) const;
138 void get_image_center (float center[3]) const;
139
141 plm_long get_num_voxels () const;
145 void get_image_extent (float extent[3]) const;
146};
147
148/* -----------------------------------------------------------------------
149 Global functions
150 ----------------------------------------------------------------------- */
151void
153 float direction_cosines[9],
154 DirectionType* itk_direction
155);
156
157#endif
The Bspline_xform class encapsulates the B-spline coefficients used by native registration and warpin...
Definition bspline_xform.h:24
Definition direction_cosines.h:23
The Plm_image_header class defines the geometry of an image. It defines image origin,...
Definition plm_image_header.h:24
void set_origin(const OriginType &origin)
Definition plm_image_header.h:63
Plm_image_header_private * d_ptr
Definition plm_image_header.h:26
The Plm_image class represents a three-dimensional volume. The volume is an abstraction that can co...
Definition plm_image.h:27
std::shared_ptr< Self > Pointer
Definition plm_image.h:29
Definition volume_header.h:17
The Volume class represents a three-dimensional volume on a uniform grid. The volume can be located a...
Definition volume.h:38
itk::Size< 3 > SizeType
Definition itk_image.h:20
itk::Vector< double, 3 > SpacingType
Definition itk_image.h:21
itk::Point< double, 3 > OriginType
Definition itk_image.h:18
itk::ImageRegion< 3 > RegionType
Definition itk_image.h:19
itk::Point< float, 3 > FloatPoint3DType
Definition itk_point.h:16
void direction_cosines_from_itk(float direction_cosines[9], DirectionType *itk_direction)
#define PLMBASE_API
Definition plmbase_config.h:19
int compare(const void *a, const void *b)
Definition simplify_points.cxx:19