2 // Don't edit this file. This file is generated from xml description..
4 #include "bbvtkImageToPlainText.h"
5 #include "bbvtkPackage.h"
10 BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,ImageToPlainText)
11 BBTK_BLACK_BOX_IMPLEMENTATION(ImageToPlainText,bbtk::AtomicBlackBox);
13 // Don't edit this file. This file is generated from xml description..
15 void ImageToPlainText::Process()
18 // THE MAIN PROCESSING METHOD BODY
19 // Here we simply set the input 'In' value to the output 'Out'
20 // And print out the output value
21 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
22 // void bbSet{Input|Output}NAME(const TYPE&)
23 // const TYPE& bbGet{Input|Output}NAME() const
25 // * NAME is the name of the input/output
26 // (the one provided in the attribute 'name' of the tag 'input')
27 // * TYPE is the C++ type of the input/output
28 // (the one provided in the attribute 'type' of the tag 'input')
29 if (bbGetInputIn() == NULL || bbGetInputInPath().size() == 0)
31 std::cout << "Set In and InPath" << std::endl;
35 ejecutar(bbGetInputInPath(), bbGetInputIn());
39 // Don't edit this file. This file is generated from xml description..
41 void ImageToPlainText::bbUserSetDefaultValues()
44 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
45 // Here we initialize the input 'In' to 0
46 std::string vacio = "";
47 bbSetInputInPath(vacio);
52 // Don't edit this file. This file is generated from xml description..
54 void ImageToPlainText::bbUserInitializeProcessing()
57 // THE INITIALIZATION METHOD BODY :
59 // but this is where you should allocate the internal/output pointers
65 // Don't edit this file. This file is generated from xml description..
67 void ImageToPlainText::bbUserFinalizeProcessing()
70 // THE FINALIZATION METHOD BODY :
72 // but this is where you should desallocate the internal/output pointers
77 void ImageToPlainText::ejecutar(std::string path, vtkImageData* image)
80 std::ofstream outFile;
81 outFile.open(path.data(), std::ios::out);
82 image->GetExtent(ext);
85 outFile << (ext[1]-ext[0]+1) << std::endl;
86 std::cout << (ext[1]-ext[0]+1) << std::endl;
87 outFile << (ext[3]-ext[2]+1) << std::endl;
88 std::cout << (ext[3]-ext[2]+1) << std::endl;
89 outFile << (ext[5]-ext[4]+1) << std::endl;
90 std::cout << (ext[5]-ext[4]+1) << std::endl;
92 for (int i=ext[0]; i<=ext[1]; i++)
94 for (int j=ext[2]; j<=ext[3]; j++)
96 for (int k=ext[4]; k<=ext[5]; k++)
98 double valor = lector.getPixelValue(i,j,k, image);
116 std::cout << "No pudo escribir en " << path << std::endl;
121 // EO namespace bbvtk