Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
itkSmoothedClassProbabilites.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef itSmoothedClassProbabilites_cpp
18 #define itSmoothedClassProbabilites_cpp
19 
21 #include "itkObjectFactory.h"
22 #include "itkImageRegionIterator.h"
23 #include "itkImageRegionConstIterator.h"
24 #include <itkDiscreteGaussianImageFilter.h>
25 
26 
27 #include <mitkImageCast.h>
28 #include <mitkIOUtil.h>
29 
30 #include <stdlib.h> /* srand, rand */
31 #include <time.h> /* time */
32 #include <sstream>
33 namespace itk
34 {
35 
36 template< class TImage>
39 {
40 
41  typename TImage::Pointer out = this->GetOutput(0);
42  out->SetRegions(this->GetInput(0)->GetLargestPossibleRegion());
43  out->Allocate();
44 
45  for(unsigned int i = 0 ; i < this->GetNumberOfInputs(); i++)
46  {
47 
49  gf->SetInput(this->GetInput(i));
50  gf->SetVariance(this->m_Sigma);
51  gf->Update();
52 
53  ImageRegionConstIterator<TImage> git(gf->GetOutput(),gf->GetOutput()->GetLargestPossibleRegion());
54  ImageRegionIterator<TImage> maskiter(m_MaskImage, m_MaskImage->GetLargestPossibleRegion());
55  ImageRegionIterator<TImage> outputIter(out, out->GetLargestPossibleRegion());
56 
57  while (!outputIter.IsAtEnd())
58  {
59  if(maskiter.Value() > 0 ){
60 
61  if(git.Value() > outputIter.Value())
62  outputIter.Set(i);
63  }else
64  {
65  outputIter.Set(0);
66  }
67 
68  ++git;
69  ++outputIter;
70  ++maskiter;
71  }
72  }
73 
74 
75 
76 
77 
78 
79 }
80 
81 }// end namespace
82 
83 #endif // itSmoothedClassProbabilites_cpp
itk::SmartPointer< Self > Pointer
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.