SIRF  3.5.0
NiftiImageData3D.h
Go to the documentation of this file.
1 /*
2 SyneRBI Synergistic Image Reconstruction Framework (SIRF)
3 Copyright 2017 - 2019 University College London
4 
5 This is software developed for the Collaborative Computational
6 Project in Synergistic Reconstruction for Biomedical Imaging (formerly CCP PETMR)
7 (http://www.ccpsynerbi.ac.uk/).
8 
9 Licensed under the Apache License, Version 2.0 (the "License");
10 you may not use this file except in compliance with the License.
11 You may obtain a copy of the License at
12 http://www.apache.org/licenses/LICENSE-2.0
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18 
19 */
20 
30 #pragma once
31 
33 
34 namespace sirf {
35 
45 template<class dataType>
46 class NiftiImageData3D : public NiftiImageData<dataType>
47 {
48 public:
49 
52 
55  : NiftiImageData<dataType>(general) { this->check_dimensions(this->_3D); }
56 
58  NiftiImageData3D(const std::string &filename)
59  : NiftiImageData<dataType>(filename) { this->check_dimensions(this->_3D); }
60 
62  NiftiImageData3D(const nifti_image &image_nifti)
63  : NiftiImageData<dataType>(image_nifti) { this->check_dimensions(this->_3D); }
64 
66  template<class inputType>
67  NiftiImageData3D(const inputType * const data, const VoxelisedGeometricalInfo3D &geom)
68  : NiftiImageData<dataType>(data, geom) { this->check_dimensions(this->_3D); }
69 
72  : NiftiImageData<dataType>(id) { this->check_dimensions(this->_3D); }
73 
74  virtual ObjectHandle<DataContainer>* new_data_container_handle() const
75  {
77  (std::shared_ptr<DataContainer>(new NiftiImageData3D));
78  }
80  std::unique_ptr<NiftiImageData3D> clone() const
81  {
82  return std::unique_ptr<NiftiImageData3D>(this->clone_impl());
83  }
84 protected:
86  virtual NiftiImageData3D* clone_impl() const
87  {
88  return new NiftiImageData3D(*this);
89  }
90 };
91 }
Base class for SIRF nifti image data.
Definition: DataHandle.h:159
Definition: ImageData.h:38
Forward declarations.
Definition: NiftiImageData3D.h:47
NiftiImageData3D(const NiftiImageData< dataType > &general)
Construct 3D from general case.
Definition: NiftiImageData3D.h:54
NiftiImageData3D(const inputType *const data, const VoxelisedGeometricalInfo3D &geom)
Construct from array.
Definition: NiftiImageData3D.h:67
std::unique_ptr< NiftiImageData3D > clone() const
Clone and return as unique pointer.
Definition: NiftiImageData3D.h:80
NiftiImageData3D()
Constructor.
Definition: NiftiImageData3D.h:51
NiftiImageData3D(const std::string &filename)
Filename constructor.
Definition: NiftiImageData3D.h:58
NiftiImageData3D(const nifti_image &image_nifti)
Nifti constructor.
Definition: NiftiImageData3D.h:62
NiftiImageData3D(const ImageData &id)
Construct from any other image data (e.g., STIRImageData)
Definition: NiftiImageData3D.h:71
virtual NiftiImageData3D * clone_impl() const
Clone helper function. Don't use.
Definition: NiftiImageData3D.h:86
Definition: NiftiImageData.h:78
void check_dimensions(const enum NiftiImageDataType image_type=_general)
Check dimensions. Don't require anything for this class.
Definition: NiftiImageData.cpp:555
Definition: GeometricalInfo.h:50
Abstract data container.
Definition: GeometricalInfo.cpp:141