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
CLStaple.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 #include "mitkCommandLineParser.h"
18 #include "mitkIOUtil.h"
19 #include <mitkImageCast.h>
20 
21 #include <itkSTAPLEImageFilter.h>
22 
23 int main(int argc, char* argv[])
24 {
25  typedef itk::Image<unsigned char, 3> MaskImageType;
26  typedef itk::Image<float, 3> ImageType;
27  typedef itk::STAPLEImageFilter<MaskImageType, ImageType> FilterType;
28 
30  filter->SetForegroundValue(2);
31  for (int i = 2; i < argc; ++i)
32  {
33  MITK_INFO << argv[i];
36  mitk::CastToItkImage(img,itkImg);
37  filter->SetInput(i-2, itkImg);
38  }
39  filter->Update();
40  auto out = filter->GetOutput();
42  mitk::CastToMitkImage(out, outImg);
43  mitk::IOUtil::SaveImage(outImg, argv[1]);
44 
45  return EXIT_SUCCESS;
46 }
itk::SmartPointer< Self > Pointer
#define MITK_INFO
Definition: mitkLogMacros.h:22
itk::Image< unsigned char, 3 > ImageType
static bool SaveImage(mitk::Image::Pointer image, const std::string &path)
SaveImage Convenience method to save an arbitrary mitkImage.
Definition: mitkIOUtil.cpp:870
int main(int argc, char *argv[])
Definition: CLStaple.cpp:23
itk::Image< unsigned char, 3 > MaskImageType
Definition: CLBrainMask.cpp:36
static Pointer New()
void CastToMitkImage(const itk::SmartPointer< ItkOutputImageType > &itkimage, itk::SmartPointer< mitk::Image > &mitkoutputimage)
Cast an itk::Image (with a specific type) to an mitk::Image.
Definition: mitkImageCast.h:78
void MITKCORE_EXPORT CastToItkImage(const mitk::Image *mitkImage, itk::SmartPointer< ItkOutputImageType > &itkOutputImage)
Cast an mitk::Image to an itk::Image with a specific type.
static mitk::Image::Pointer LoadImage(const std::string &path)
LoadImage Convenience method to load an arbitrary mitkImage.
Definition: mitkIOUtil.cpp:597
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.