Shapeworks Studio  2.1
Shape analysis software suite
psmPreprocessor.cxx
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #include <iostream>
19 #include <itkImageFileReader.h>
20 #include <itkImageFileWriter.h>
21 //#include <itkPSMCleanTrimLabelMapImageFilter.h>
22 #include <itkPSMImplicitSurfaceImageFilter.h>
23 
24 int main_ (int argc, char *argv[])
25 {
26  if (argc < 5)
27  {
28  std::cout << "Usage:" << argv[0]
29  << "output_prefix smoothing_sigma isosurface_value input_file_1 input_file_2 ..." << std::endl;
30  return 1;
31  }
32 
33  double sigma = 0.0;
34  double isosurface_value = 0.5;
35  if (argc > 3)
36  { sigma = atof(argv[3]); }
37  if (argc >4)
38  { isosurface_value = atof(argv[4]); }
39 
40 
41  typedef itk::Image<float, 3> image_type;
42 
43  try {
44 
45 
46  // First read all of the files one by one and compute the bounding box.
47 
48 
49 
50  std::cout << "Reading " << argv[4] << std::endl;
51  itk::ImageFileReader<image_type>::Pointer reader
52  = itk::ImageFileReader<image_type>::New();
53  reader->SetFileName(argv[4]);
54  reader->Update();
55 
56  itk::ImageFileWriter<image_type>::Pointer fwriter
57  = itk::ImageFileWriter<image_type>::New();
58  // fwriter->SetInput(filt->GetOutput());
59  // fwriter->SetFileName("tmp.nrrd");
60  // fwriter->Update();
61 
62  }
63  catch (itk::ExceptionObject &e)
64  {
65  std::cerr << e << std::endl;
66  return 1;
67  }
68  catch( ...)
69  {
70  std::cerr << "Unknown error" << std::endl;
71  return 2;
72  }
73 
74  return 0;
75 }
76