1 /*
2  * Medical Image Registration ToolKit (MIRTK)
3  *
4  * Copyright 2008-2015 Imperial College London
5  * Copyright 2008-2015 Daniel Rueckert, Julia Schnabel
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
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 #include "mirtk/Vector4D.h"
21 
22 namespace mirtk {
23 
24 
25 // -----------------------------------------------------------------------------
operator /(const Vector4D<T> & v) const26 template <typename T> Vector4D<T> Vector4D<T>::operator /(const Vector4D<T> &v) const
27 {
28   const T zero(0);
29   Vector4D<T> val(zero);
30   if (v._x != zero) val._x = _x / v._x;
31   if (v._y != zero) val._y = _y / v._y;
32   if (v._z != zero) val._z = _z / v._z;
33   if (v._t != zero) val._t = _t / v._t;
34   return val;
35 }
36 
37 // -----------------------------------------------------------------------------
operator /=(const Vector4D<T> & v)38 template <typename T> Vector4D<T> &Vector4D<T>::operator /=(const Vector4D<T> &v)
39 {
40   const T zero(0);
41   if (v._x != zero) _x /= v._x;
42   if (v._y != zero) _y /= v._y;
43   if (v._z != zero) _z /= v._z;
44   if (v._t != zero) _t /= v._t;
45   return *this;
46 }
47 
48 // -----------------------------------------------------------------------------
49 template struct Vector4D<char>;
50 template struct Vector4D<short>;
51 template struct Vector4D<float>;
52 template struct Vector4D<double>;
53 
54 
55 } // namespace mirtk
56