1 <?xml version="1.0" encoding="iso-8859-1"?>
3 <blackbox name="MetaImageWriter" type="VTK_ImageAlgorithm">
5 <author>laurent.guigues at creatis.insa-lyon.fr</author>
6 <description><PRE>Writes .mhd / .mhd image formats (bbfication of vtkMetaImageWriter)</PRE></description>
7 <category>image;read/write</category>
9 <include>vtkMetaImageWriter.h</include>
10 <include>vtkImageData.h</include>
12 <vtkobject>vtkMetaImageWriter</vtkobject>
14 <input name="Filename" type="std::string" nature="file name" description="Name of the file to write"/>
15 <input name="In" type="vtkImageData*" description="Input image" />
16 <input name="Compression" type="bool" description="default(false) true/false" />
20 vtkMetaImageWriter* w = vtkMetaImageWriter::New();
23 //EED 2017-01-01 Migration VTK7
24 #if VTK_MAJOR_VERSION <= 5
25 bbGetInputIn()->Update();
31 if (bbGetInputIn() == 0)
32 std::cout << "======================= Katastrophe : bbGetInputIn() == 0 " << std::endl;
34 std::cout << "======================= OK : bbGetInputIn() not NULL " << std::endl;
36 bbGetInputIn()->PrintSelf(std::cout, vtkIndent(1));
37 bbGetInputIn()->GetSpacing(spacing);
38 std::cout << "=======" << spacing[0] << " " << spacing[1] << " " << spacing[2] << std::endl;
42 if (bbGetInputIn()!=NULL)
45 //EED 2017-01-01 Migration VTK7
46 #if VTK_MAJOR_VERSION <= 5
47 w->SetInput(bbGetInputIn());
49 w->SetInputData(bbGetInputIn());
51 w->SetCompression(bbGetInputCompression());
52 w->SetFileDimensionality(bbGetInputIn()->GetDataDimension()); // NTU
53 std::string userGivenName = bbGetInputFilename();
54 if (userGivenName.substr(userGivenName.size()-4) != ".mhd") //JPR
56 userGivenName += ".mhd";
58 w->SetFileName(userGivenName.c_str());
59 //w->SetFileName(bbGetInputFilename().c_str()); // JPR
60 //EEDJuly22-2014 w->Update(); // Fred
62 } // bbGetInputIn()!=NULL
69 bbSetInputCompression(false);