SIRF  3.5.0
Registration.h
Go to the documentation of this file.
1 /*
2 SyneRBI Synergistic Image Reconstruction Framework (SIRF)
3 Copyright 2017 - 2020 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 
32 #include <string>
33 #include <vector>
34 #include <memory>
35 
36 namespace sirf {
37 
39 template<class dataType> class Transformation;
40 class ImageData;
41 
70 template<class dataType>
72 {
73 public:
74 
77 
79  virtual ~Registration() {}
80 
82  void set_reference_image(const std::shared_ptr<const ImageData> reference_image_sptr);
83 
85  void set_floating_image(const std::shared_ptr<const ImageData> floating_image_sptr);
86 
88  void add_floating_image(const std::shared_ptr<const ImageData> floating_image_sptr);
89 
91  void set_reference_image_filename(const std::string &filename);
92 
94  void set_floating_image_filename(const std::string &filename);
95 
97  void add_floating_image_filename(const std::string &filename);
98 
100  void clear_floating_images();
101 
103  virtual void process() = 0;
104 
106  virtual const std::shared_ptr<const ImageData> get_output_sptr(const unsigned idx = 0) const { return _warped_images.at(idx); }
107 
109  virtual const std::shared_ptr<const Transformation<dataType> > get_deformation_field_forward_sptr(const unsigned idx = 0) const { return _def_fwd_images.at(idx); }
110 
112  virtual const std::shared_ptr<const Transformation<dataType> > get_deformation_field_inverse_sptr(const unsigned idx = 0) const = 0;
113 
115  virtual const std::shared_ptr<const Transformation<dataType> > get_displacement_field_forward_sptr(const unsigned idx = 0) const = 0;
116 
118  virtual const std::shared_ptr<const Transformation<dataType> > get_displacement_field_inverse_sptr(const unsigned idx = 0) const = 0;
119 
120 protected:
121 
123  virtual void check_parameters() const;
124 
126  std::shared_ptr<const ImageData> _reference_image_sptr;
128  std::vector<std::shared_ptr<const ImageData> > _floating_images;
130  std::vector<std::shared_ptr<ImageData> > _warped_images;
131 
133  std::vector<std::shared_ptr<Transformation<dataType> > > _def_fwd_images;
134 
136  std::string _reference_image_filename = "";
138  std::vector<std::string> _floating_image_filenames;
139 };
140 }
Base class for all SIRF registration.
Definition: Registration.h:72
std::vector< std::shared_ptr< const ImageData > > _floating_images
Floating image.
Definition: Registration.h:128
void set_reference_image(const std::shared_ptr< const ImageData > reference_image_sptr)
Set reference image.
Definition: Registration.cpp:37
virtual void process()=0
Process.
virtual const std::shared_ptr< const Transformation< dataType > > get_displacement_field_inverse_sptr(const unsigned idx=0) const =0
Get inverse displacement field image.
void set_reference_image_filename(const std::string &filename)
Set reference image filename. Will be read as NiftiImageData.
Definition: Registration.cpp:67
virtual void check_parameters() const
Check parameters.
Definition: Registration.cpp:103
virtual const std::shared_ptr< const Transformation< dataType > > get_deformation_field_forward_sptr(const unsigned idx=0) const
Get forward deformation field image.
Definition: Registration.h:109
std::string _reference_image_filename
Reference image filename.
Definition: Registration.h:136
virtual ~Registration()
Destructor.
Definition: Registration.h:79
void add_floating_image_filename(const std::string &filename)
Add floating image filename. Will be read as NiftiImageData.
Definition: Registration.cpp:86
Registration()
Constructor.
Definition: Registration.h:76
void clear_floating_images()
Clear floating images.
Definition: Registration.cpp:97
virtual const std::shared_ptr< const Transformation< dataType > > get_deformation_field_inverse_sptr(const unsigned idx=0) const =0
Get inverse deformation field image.
virtual const std::shared_ptr< const ImageData > get_output_sptr(const unsigned idx=0) const
Get registered image.
Definition: Registration.h:106
void add_floating_image(const std::shared_ptr< const ImageData > floating_image_sptr)
Add floating image.
Definition: Registration.cpp:56
std::vector< std::shared_ptr< ImageData > > _warped_images
Warped image.
Definition: Registration.h:130
void set_floating_image_filename(const std::string &filename)
Set floating image filename. Will be read as NiftiImageData.
Definition: Registration.cpp:74
virtual const std::shared_ptr< const Transformation< dataType > > get_displacement_field_forward_sptr(const unsigned idx=0) const =0
Get forward displacement field image.
std::vector< std::shared_ptr< Transformation< dataType > > > _def_fwd_images
Forward deformation field image.
Definition: Registration.h:133
std::vector< std::string > _floating_image_filenames
Floating image filenames.
Definition: Registration.h:138
std::shared_ptr< const ImageData > _reference_image_sptr
Reference image.
Definition: Registration.h:126
void set_floating_image(const std::shared_ptr< const ImageData > floating_image_sptr)
Set floating image. Will clear any previous floating images.
Definition: Registration.cpp:44
Abstract data container.
Definition: GeometricalInfo.cpp:141