STIR  6.2.0
VoxelsOnCartesianGrid.h
Go to the documentation of this file.
1 //
2 //
3 /*
4  Copyright (C) 2000 PARAPET partners
5  Copyright (C) 2000- 2007, Hammersmith Imanet Ltd
6  Copyright (C) 2018-2019, University College London
7  This file is part of STIR.
8 
9  SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license
10 
11  See STIR/LICENSE.txt for details
12 */
13 
14 #ifndef __stir_VoxelsOnCartesianGrid_H__
15 #define __stir_VoxelsOnCartesianGrid_H__
16 
30 
31 START_NAMESPACE_STIR
32 
33 class ProjDataInfo;
34 template <typename elemT>
35 class PixelsOnCartesianGrid;
36 
44 template <class elemT>
45 class VoxelsOnCartesianGrid : public DiscretisedDensityOnCartesianGrid<3, elemT>
46 {
47 
48 public:
49 #if 0
50 static VoxelsOnCartesianGrid ask_parameters();
52 #endif
53 
55  VoxelsOnCartesianGrid();
56 
58  VoxelsOnCartesianGrid(const Array<3, elemT>& v,
59  const CartesianCoordinate3D<float>& origin,
60  const BasicCoordinate<3, float>& grid_spacing);
61 
63 
64  VoxelsOnCartesianGrid(const IndexRange<3>& range,
65  const CartesianCoordinate3D<float>& origin,
66  const BasicCoordinate<3, float>& grid_spacing);
67 
69  VoxelsOnCartesianGrid(const shared_ptr<const ExamInfo>& exam_info_sptr,
70  const Array<3, elemT>& v,
71  const CartesianCoordinate3D<float>& origin,
72  const BasicCoordinate<3, float>& grid_spacing);
73 
75 
76  VoxelsOnCartesianGrid(const shared_ptr<const ExamInfo>& exam_info_sptr,
77  const IndexRange<3>& range,
78  const CartesianCoordinate3D<float>& origin,
79  const BasicCoordinate<3, float>& grid_spacing);
80 
81  // KT 10/12/2001 replace 2 constructors with the more general one below
83 
106  VoxelsOnCartesianGrid(const ProjDataInfo& proj_data_info_ptr,
107  const float zoom = 1.F,
108  const CartesianCoordinate3D<float>& origin = CartesianCoordinate3D<float>(0.F, 0.F, 0.F),
109  const CartesianCoordinate3D<int>& sizes = CartesianCoordinate3D<int>(-1, -1, -1));
110 
112 
117  VoxelsOnCartesianGrid(const shared_ptr<const ExamInfo>& exam_info_sptr,
118  const ProjDataInfo& proj_data_info,
119  const float zoom = 1.F,
120  const CartesianCoordinate3D<float>& origin = CartesianCoordinate3D<float>(0.F, 0.F, 0.F),
121  const CartesianCoordinate3D<int>& sizes = CartesianCoordinate3D<int>(-1, -1, -1));
122 
124 
129  VoxelsOnCartesianGrid(const shared_ptr<const ExamInfo>& exam_info_sptr_v,
130  const ProjDataInfo& proj_data_info,
131  const CartesianCoordinate3D<float>& zooms,
132  const CartesianCoordinate3D<float>& origin = CartesianCoordinate3D<float>(0.F, 0.F, 0.F),
133  const CartesianCoordinate3D<int>& sizes = CartesianCoordinate3D<int>(-1, -1, -1));
134 
136 #ifdef STIR_NO_COVARIANT_RETURN_TYPES
137  DiscretisedDensity<3, elemT>*
138 #else
139  VoxelsOnCartesianGrid<elemT>*
140 #endif
141  get_empty_copy() const override;
142 
144  VoxelsOnCartesianGrid<elemT>* get_empty_voxels_on_cartesian_grid() const;
145 
146 #ifdef STIR_NO_COVARIANT_RETURN_TYPES
147  virtual DiscretisedDensity<3, elemT>*
148 #else
149  VoxelsOnCartesianGrid<elemT>*
150 #endif
151  clone() const override;
152 
154  PixelsOnCartesianGrid<elemT> get_plane(const int z) const;
155 
157  void set_plane(const PixelsOnCartesianGrid<elemT>& plane, const int z);
158 
160  inline CartesianCoordinate3D<float> get_voxel_size() const;
161 
163  void set_voxel_size(const BasicCoordinate<3, float>&);
164 
166  void grow_z_range(const int min_z, const int max_z);
167 
169 
172  inline int get_x_size() const;
173 
174  inline int get_y_size() const;
175 
176  inline int get_z_size() const;
177 
178  inline int get_min_x() const;
179 
180  inline int get_min_y() const;
181 
182  inline int get_min_z() const;
183 
184  inline int get_max_x() const;
185 
186  inline int get_max_y() const;
187 
188  inline int get_max_z() const;
189 
190  BasicCoordinate<3, int> get_lengths() const;
191  BasicCoordinate<3, int> get_min_indices() const;
192  BasicCoordinate<3, int> get_max_indices() const;
193 
195 
196 private:
197  void construct_from_projdata_info(const shared_ptr<const ExamInfo>& exam_info_sptr_v,
198  const ProjDataInfo& proj_data_info,
199  const CartesianCoordinate3D<float>& zooms,
200  const CartesianCoordinate3D<float>& origin,
201  const CartesianCoordinate3D<int>& sizes);
202 };
203 
204 END_NAMESPACE_STIR
205 
207 #endif
BasicCoordinate< num_dimensions, int > get_min_indices(const Array< num_dimensions, T > &a)
Get the first multi-dimensional index of the array.
Definition: array_index_functions.inl:100
inline implementations for the stir::VoxelsOnCartesianGrid class
defines the stir::DiscretisedDensityOnCartesianGrid class
defines the stir::CartesianCoordinate3D<coordT> class