]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkXMLImageDataWriter.cxx
#3148 creaVtkFeature New Normal - VtkXMLImageDataWriter box to white vti files
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkXMLImageDataWriter.cxx
1 //===== 
2 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
3 //===== 
4 #include "bbcreaVtkXMLImageDataWriter.h"
5 #include "bbcreaVtkPackage.h"
6
7 #include "vtkJSONImageWriter.h"
8 #include "vtkXMLImageDataWriter.h"
9 #include "vtkXMLDataSetWriter.h"
10 #include "vtkDataSetWriter.h"
11 #include "vtkPDataSetWriter.h"
12
13
14 namespace bbcreaVtk
15 {
16
17 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,XMLImageDataWriter)
18 BBTK_BLACK_BOX_IMPLEMENTATION(XMLImageDataWriter,bbtk::AtomicBlackBox);
19 //===== 
20 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
21 //===== 
22 void XMLImageDataWriter::Process()
23 {
24
25 // THE MAIN PROCESSING METHOD BODY
26 //   Here we simply set the input 'In' value to the output 'Out'
27 //   And print out the output value
28 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
29 //    void bbSet{Input|Output}NAME(const TYPE&)
30 //    const TYPE& bbGet{Input|Output}NAME() const 
31 //    Where :
32 //    * NAME is the name of the input/output
33 //      (the one provided in the attribute 'name' of the tag 'input')
34 //    * TYPE is the C++ type of the input/output
35 //      (the one provided in the attribute 'type' of the tag 'input')
36
37 //    bbSetOutputOut( bbGetInputIn() );
38 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
39
40
41         auto writer = vtkXMLImageDataWriter::New();
42         writer->SetDataModeToBinary();
43         writer->SetFileName( bbGetInputFileName().c_str() );
44         writer->SetInputData( bbGetInputIn() );
45         writer->Write();
46
47
48 /*
49         auto writer = vtkJSONImageWriter::New();
50         writer->SetFileName( bbGetInputFileName().c_str() );
51         writer->SetInputData( bbGetInputIn() );
52         writer->Write();
53 */
54
55 /*
56         auto writer = vtkXMLDataSetWriter::New();
57         write->SetDataModeToBinary();
58         writer->SetFileName( bbGetInputFileName().c_str() );
59         writer->SetInputData( bbGetInputIn() );
60         writer->Write();
61 */
62
63 /*
64         auto writer = vtkDataSetWriter::New();
65         writer->SetFileTypeToBinary();
66         writer->SetFileName( bbGetInputFileName().c_str() );
67         writer->SetInputData( bbGetInputIn() );
68         writer->Write();
69 */
70 }
71
72 //===== 
73 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
74 //===== 
75 void XMLImageDataWriter::bbUserSetDefaultValues()
76 {
77
78 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
79 //    Here we initialize the input 'In' to 0
80    bbSetInputIn(0);
81   
82 }
83 //===== 
84 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
85 //===== 
86 void XMLImageDataWriter::bbUserInitializeProcessing()
87 {
88
89 //  THE INITIALIZATION METHOD BODY :
90 //    Here does nothing 
91 //    but this is where you should allocate the internal/output pointers 
92 //    if any 
93
94   
95 }
96 //===== 
97 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
98 //===== 
99 void XMLImageDataWriter::bbUserFinalizeProcessing()
100 {
101
102 //  THE FINALIZATION METHOD BODY :
103 //    Here does nothing 
104 //    but this is where you should desallocate the internal/output pointers 
105 //    if any
106   
107 }
108 }
109 // EO namespace bbcreaVtk
110
111