void ImageReader::Read()
{
+printf("EED ImageReader::Read start\n");
std::string filename = bbGetInputIn();
itk::ImageIOBase::Pointer genericReader =
bbtk::TypeInfo typ = GetITKImagePtrTypeInfoFromPixelTypeInfoAndDimension(genericReader->GetComponentTypeInfo(), genericReader->GetNumberOfDimensions());
BBTK_TEMPLATE_ITK_IMAGE_SWITCH( typ, Read);
+
+printf("EED ImageReader::Read end\n");
+
}
void FilesFromDirectory::Process()
{
+printf("EED FilesFromDirectory::Process Start\n");
+
Filenames.clear();
SimpleFilenames.clear();
DirName = bbGetInputIn();
CleanFilenames( bbGetInputIn() );
bbSetOutputOut(Filenames);
bbSetOutputOutSimple(SimpleFilenames);
+
+printf("EED FilesFromDirectory::Process End\n");
}
void FilesFromDirectory::bbUserSetDefaultValues()
{
firsttime=false;
/* initialize random seed: */
- srand (time(NULL));
+ srand (time(NULL));
if (bbGetInputType()==7) acum=bbGetInputIn1();
}
- if (bbGetInputType()==0) bbSetOutputOut( bbGetInputIn1() + bbGetInputIn2() );
+ if (bbGetInputType()==0)
+ {
+ bbSetOutputOut( bbGetInputIn1() + bbGetInputIn2() );
+ }
if (bbGetInputType()==1) bbSetOutputOut( bbGetInputIn1() - bbGetInputIn2() );
if (bbGetInputType()==2) bbSetOutputOut( bbGetInputIn1() * bbGetInputIn2() );
if (bbGetInputType()==7)
{
- bbSetOutputOut( acum );
- acum++;
- if (acum>bbGetInputIn2()) acum=bbGetInputIn1();
+ if ( back_acum_In1!=bbGetInputIn1() ) acum=bbGetInputIn1();
+ if (acum<bbGetInputIn1()) acum=bbGetInputIn1();
+ bbSetOutputOut( acum );
+ acum++;
+ if (acum>bbGetInputIn2()) acum=bbGetInputIn1();
+ back_acum_In1=bbGetInputIn1();
}
if (bbGetInputType()==8 ) bbSetOutputOut( rand() % (int) (bbGetInputIn2()-bbGetInputIn1()) + bbGetInputIn1() );
if (bbGetInputType()==9 ) bbSetOutputOut( sin( bbGetInputIn1() ) );
if (bbGetInputType()==16) bbSetOutputOut( std::min( bbGetInputIn1(),bbGetInputIn2() ) );
if (bbGetInputType()==17) bbSetOutputOut( std::max( bbGetInputIn1(),bbGetInputIn2() ) );
if (bbGetInputType()==18) bbSetOutputOut( fabs( bbGetInputIn1() ) );
+ if (bbGetInputType()==19) bbSetOutputOut( (int)bbGetInputIn1() % (int)bbGetInputIn2() );
}
//=====
// 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)
bool firsttime;
double acum;
+ double back_acum_In1;
+ double back_acum_In2;
//=====
// 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)
BBTK_CATEGORY("empty");
BBTK_INPUT(MathOperation,In1,"First input",double,"");
BBTK_INPUT(MathOperation,In2,"Second input",double,"");
- BBTK_INPUT(MathOperation,Type,"Type (defalult 0): 0 adition (default), 1 sustraction In1-In2, 2 multiplication In1*In2, 3 divisiuon In1/In2, 4 sqrt In1, 5 log In1, 6 exp In1, 7 incremental int [In1..In2], 8 random int [In1..In2], 9 sin In1-rad, 10 cos In1-rad, 11 tan In1-rad, 12 asin In 1, 13 acos In1, 14 atan In1, 15 atan2 In1 In2 , 16 min, 17 max, 18 abs In1 ",int,"");
+ BBTK_INPUT(MathOperation,Type,"Type (defalult 0): 0 adition (default), 1 sustraction In1-In2, 2 multiplication In1*In2, 3 divisiuon In1/In2, 4 sqrt In1, 5 log In1, 6 exp In1, 7 incremental int [In1..In2], 8 random int [In1..In2], 9 sin In1-rad, 10 cos In1-rad, 11 tan In1-rad, 12 asin In 1, 13 acos In1, 14 atan In1, 15 atan2 In1 In2 , 16 min, 17 max, 18 abs In1, 19 module In1%In2 ",int,"");
BBTK_OUTPUT(MathOperation,Out,"Output",double,"");
BBTK_END_DESCRIBE_BLACK_BOX(MathOperation);
bbSetOutputOut( resultVec );
} // Type 18
+ if (bbGetInputType()==19)
+ {
+ for (i=0;i<sizeVec;i++)
+ {
+ resultVec.push_back( (int)bbGetInputIn0()[i] % (int)bbGetInputIn1()[i] );
+ } // for i
+ bbSetOutputOut( resultVec );
+ } // Type 18
}
BBTK_INPUT(MathOperationVector,In7,"Input vector 7",std::vector<double>,"");
BBTK_INPUT(MathOperationVector,In8,"Input vector 8",std::vector<double>,"");
BBTK_INPUT(MathOperationVector,In9,"Input vector 9",std::vector<double>,"");
- BBTK_INPUT(MathOperationVector,Type,"Type (defalult 0): 0 adition (default) In0[i]+In1[i]+..+In9[i], -99 adition In0[i] In1[i] ... In[9], 1 sustraction In0[i]-In1[i]-..-In9[i], 2 multiplication In0[i]*In2[i]*...*In9[i], 3 divisiuon In0/In2/.../In9, 4 sqrt In1, 5 log10 In1, 6 exp In1, 7 incremental int [In0..In1], 8 random int [In0..In1], 9 (rad) sin In0, 10 (rad) cos In0, 11 tan (rad) In0, 12 asin In0, 13 acos In0, 14 atan In0, 15 atan2 In0 In1 , 16 min (In0[i],In1[i]..In9[i]), -16 min(In0) min(In1) ... min(In9) , 17 max (In0[i],In1[i]..In9[i]), -17 max(In0) max(In1) ... max(In9) , 18 abs In0 " ,int,"");
+ BBTK_INPUT(MathOperationVector,Type,"Type (defalult 0): 0 adition (default) In0[i]+In1[i]+..+In9[i], -99 adition In0[i] In1[i] ... In[9], 1 sustraction In0[i]-In1[i]-..-In9[i], 2 multiplication In0[i]*In2[i]*...*In9[i], 3 divisiuon In0/In2/.../In9, 4 sqrt In1, 5 log10 In1, 6 exp In1, 7 incremental int [In0..In1], 8 random int [In0..In1], 9 (rad) sin In0, 10 (rad) cos In0, 11 tan (rad) In0, 12 asin In0, 13 acos In0, 14 atan In0, 15 atan2 In0 In1 , 16 min (In0[i],In1[i]..In9[i]), -16 min(In0) min(In1) ... min(In9) , 17 max (In0[i],In1[i]..In9[i]), -17 max(In0) max(In1) ... max(In9) , 18 abs In0 , 19 module In0[i]%In1[i] " ,int,"");
BBTK_OUTPUT(MathOperationVector,Out,"Output vector",std::vector<double>,"");
--- /dev/null
+//=====
+// 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)
+//=====
+#include "bbwxDropFiles.h"
+#include "bbwxPackage.h"
+
+#include "bbtkWx.h"
+#include <wx/dnd.h>
+
+namespace bbwx
+{
+
+
+class WxDropFiles: public wxFileDropTarget
+{
+public:
+ WxDropFiles(DropFiles *box): mbox(box){}
+ bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& arrFilenames);
+private:
+ DropFiles *mbox;
+};
+
+bool WxDropFiles::OnDropFiles(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), const wxArrayString& arrFilenames)
+{
+ std::vector<std::string> tmpLst;
+ int i,sizeArrFilenames=arrFilenames.GetCount();
+ for( i=0 ; i<sizeArrFilenames ; i++ )
+ {
+ std::string ss=bbtk::wx2std( arrFilenames.Item(i) );
+ tmpLst.push_back( bbtk::wx2std( arrFilenames.Item(i) ) );
+ }
+
+ mbox->bbSetOutputLstPaths( tmpLst );
+ mbox->bbSignalOutputModification( );
+ return true;
+}
+
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,DropFiles)
+BBTK_BLACK_BOX_IMPLEMENTATION(DropFiles,bbtk::AtomicBlackBox);
+//=====
+// 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)
+//=====
+void DropFiles::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+// Here we simply set the input 'In' value to the output 'Out'
+// And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+// void bbSet{Input|Output}NAME(const TYPE&)
+// const TYPE& bbGet{Input|Output}NAME() const
+// Where :
+// * NAME is the name of the input/output
+// (the one provided in the attribute 'name' of the tag 'input')
+// * TYPE is the C++ type of the input/output
+// (the one provided in the attribute 'type' of the tag 'input')
+
+// bbSetOutputOut( bbGetInputIn() );
+// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+
+ if (bbGetInputWidget()!=NULL)
+ {
+ bbGetInputWidget()->SetDropTarget( new WxDropFiles(this) );
+ }
+
+}
+//=====
+// 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)
+//=====
+void DropFiles::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputWidget(NULL);
+
+}
+//=====
+// 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)
+//=====
+void DropFiles::bbUserInitializeProcessing()
+{
+
+// THE INITIALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should allocate the internal/output pointers
+// if any
+
+
+}
+//=====
+// 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)
+//=====
+void DropFiles::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbwx
+
+
--- /dev/null
+//=====
+// 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)
+//=====
+#ifndef __bbwxDropFiles_h_INCLUDED__
+#define __bbwxDropFiles_h_INCLUDED__
+#include "bbwx_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include <wx/wxprec.h>
+#ifndef WX_PRECOMP
+// Include your minimal set of headers here, or wx.h
+#include <wx/wx.h>
+#endif
+#include <wx/window.h>
+
+namespace bbwx
+{
+
+class bbwx_EXPORT DropFiles
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(DropFiles,bbtk::AtomicBlackBox);
+//=====
+// 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)
+//=====
+ BBTK_DECLARE_INPUT(Widget,wxWindow*);
+ BBTK_DECLARE_OUTPUT(LstPaths,std::vector<std::string>);
+ BBTK_PROCESS(Process);
+ void Process();
+//=====
+// 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)
+//=====
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(DropFiles,bbtk::AtomicBlackBox);
+ BBTK_NAME("DropFiles");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+ BBTK_INPUT(DropFiles,Widget,"wxWidget",wxWindow*,"");
+ BBTK_OUTPUT(DropFiles,LstPaths,"List of paths",std::vector<std::string>,"");
+BBTK_END_DESCRIBE_BLACK_BOX(DropFiles);
+//=====
+// 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)
+//=====
+}
+// EO namespace bbwx
+
+#endif // __bbwxDropFiles_h_INCLUDED__
+