Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
CLSurWeighting.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 #ifndef mitkForest_cpp
17 #define mitkForest_cpp
18 
19 #include "time.h"
20 #include <sstream>
21 
22 #include <mitkDataCollection.h>
23 #include <mitkCollectionReader.h>
24 #include <mitkCollectionWriter.h>
26 #include <vtkSmartPointer.h>
27 #include <mitkIOUtil.h>
28 #include <sstream>
29 
31 
32 int main(int argc, char* argv[])
33 {
34  MITK_INFO << "Argc " << argc;
35 
37  // Read Images
40 
41  MITK_INFO << "Arg 2 " << argv[2];
43  col->AddData(sur.GetPointer(),"sur");
44  MITK_INFO << "Arg 3 " << argv[3];
46  col->AddData(mask.GetPointer(),"mask");
47 
48  std::vector<std::string> modalities;
49  for (int i = 4; i < argc; ++i)
50  {
51  MITK_INFO << "Img " << argv[i];
52  std::stringstream ss;
53  ss << i;
54  modalities.push_back(ss.str());
56  col->AddData(img.GetPointer(),ss.str());
57  }
58 
60  est.SetCollection(col);
61  est.SetTrainMask("sur");
62  est.SetTestMask("mask");
63  est.SetModalities(modalities);
64  est.SetWeightName("weight");
65  est.Update();
66 
67  mitk::Image::Pointer w= col->GetMitkImage("weight");
68  mitk::IOUtil::SaveImage(w,argv[1]);
69 
70  return 0;
71 }
72 
73 #endif
void SetWeightName(std::string name)
#define MITK_INFO
Definition: mitkLogMacros.h:22
void SetTrainMask(std::string name)
static bool SaveImage(mitk::Image::Pointer image, const std::string &path)
SaveImage Convenience method to save an arbitrary mitkImage.
Definition: mitkIOUtil.cpp:870
void SetTestMask(std::string name)
void SetModalities(std::vector< std::string > modalities)
int main(int argc, char *argv[])
void SetCollection(DataCollection::Pointer data)
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.