ITK/Examples/Utilities/FileOutputWindow: Difference between revisions

From KitwarePublic
< ITK‎ | Examples
Jump to navigationJump to search
(ITK backward compatibility)
(Deprecated content that is moved to sphinx)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
On linux systems, warning will be reported to the console. On windows system warnings will be reported in a popup. This example illustrates how to redirect warnings to a file.
{{warning|1=The media wiki content on this page is no longer maintained. The examples presented on the https://itk.org/Wiki/*  pages likely require ITK version 4.13 or earlier releasesIn many cases, the examples on this page no longer conform to the best practices for modern ITK versions.}}
 
==FileOutputWindow.cxx==
<source lang="cpp">
#include <itkFileOutputWindow.h>
#include <itkScaleTransform.h>
 
int main(int argc, char* argv[])
{
  typedef itk::FileOutputWindow myFileOutputWindow;
  myFileOutputWindow::Pointer window = myFileOutputWindow::New();
 
  if (argc > 1)
    {
    window->SetFileName(argv[1]);
    }
  window->FlushOn();
 
  // Set the singelton instance
  itk::OutputWindow::SetInstance(window);
 
  // Generic output
  itkGenericOutputMacro("This should be in the file: " << window->GetFileName());
  // Warning
  typedef itk::ScaleTransform<float,2> TransformType;
  TransformType::Pointer transform = TransformType::New();
#if defined(ITK_FIXED_PARAMETERS_ARE_DOUBLE) // After 4.8.1
  TransformType::FixedParametersType parameters(3);
#else                                        //Pre 4.8.1
   TransformType::ParametersType parameters(3);
#endif
  transform->SetFixedParameters(parameters);
 
  std::cout << "Look in " << window->GetFileName() << " for the output" << std::endl;
  return EXIT_SUCCESS;
 
}
</source>
{{ITKCMakeLists|{{SUBPAGENAME}}}}

Latest revision as of 21:04, 6 June 2019

Warning: The media wiki content on this page is no longer maintained. The examples presented on the https://itk.org/Wiki/* pages likely require ITK version 4.13 or earlier releases. In many cases, the examples on this page no longer conform to the best practices for modern ITK versions.