SIRF  3.5.0
ImageWeightedMean.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 
32 #include <vector>
33 #include <memory>
34 
35 namespace sirf {
36 
37 // Forward delcarations
38 template<class dataType> class NiftiImageData;
39 
50 template<class dataType>
52 {
53 public:
54 
57 
60 
62  void add_image(const NiftiImageData<dataType> &image, const float weight);
63 
65  void process();
66 
68  const std::shared_ptr<const NiftiImageData<dataType> > get_output_sptr() const { return _output_image_sptr; }
69 
70 protected:
71 
73  void check_can_do_mean() const;
74 
78  std::vector<std::shared_ptr<const NiftiImageData<dataType> > > _input_image_sptrs;
80  std::vector<float> _weights;
82  std::shared_ptr<NiftiImageData<dataType> > _output_image_sptr;
83 
84 };
85 }
Definition: ImageWeightedMean.h:52
void check_can_do_mean() const
Check if its possible to calculate the mean.
Definition: ImageWeightedMean.cpp:102
~ImageWeightedMean()
Destructor.
Definition: ImageWeightedMean.h:59
std::shared_ptr< NiftiImageData< dataType > > _output_image_sptr
Output image.
Definition: ImageWeightedMean.h:82
void add_image(const NiftiImageData< dataType > &image, const float weight)
Add an image (from NiftImage) and its corresponding weight.
Definition: ImageWeightedMean.cpp:44
std::vector< std::shared_ptr< const NiftiImageData< dataType > > > _input_image_sptrs
Vector of input images.
Definition: ImageWeightedMean.h:78
ImageWeightedMean()
Constructor.
Definition: ImageWeightedMean.cpp:38
std::vector< float > _weights
Vector of weights.
Definition: ImageWeightedMean.h:80
const std::shared_ptr< const NiftiImageData< dataType > > get_output_sptr() const
Get output.
Definition: ImageWeightedMean.h:68
bool _need_to_update
Bool to check if update is necessary.
Definition: ImageWeightedMean.h:76
void process()
Process.
Definition: ImageWeightedMean.cpp:54
Definition: NiftiImageData.h:78
Abstract data container.
Definition: GeometricalInfo.cpp:141