// Should only contain one!
l = sh->GetFirstSingleSerieUIDFileSet();
- int nbFiles;
- double zspacing = 0.;
- nbFiles = l->size() ;
+ double zspacing = 0.;
sh->OrderFileList(l); // this one should compute the *actual* Z Spacing!
zspacing = sh->GetZSpacing();
std::vector<double> v_pixelspacing;
// v_pixelspacing.push_back(f->GetZSpacing());
// }
bbSetOutputPixelSpacing(v_pixelspacing);
+
+ VectorMapInfoDicom vectormapinfodicom;
+ uint16_t group;
+ uint16_t elem;
+ std::string key;
+ std::string strTagValue; // read on disc
+ int iTag,sizeDicomTagsVector=bbGetInputDicomTags().size();
+ GDCM_NAME_SPACE::FileList::const_iterator iitt = l->begin();
+ //iitt ++;
+ for ( ; iitt != l->end(); ++iitt)
+ {
+ MapInfoDicom mapinfodicom;
+
+ for (iTag=0; iTag<sizeDicomTagsVector; iTag++)
+ {
+ key = bbGetInputDicomTags()[iTag];
+ group = elem = 0;
+ if ( (key.size()==10) && (key[0] == 'D') && (key[5] == '_') )
+ {
+ sscanf(key.c_str(),"D%04hx_%04hx ",&group,&elem);
+ }// if key
+ strTagValue = (*iitt)->GetEntryString(group,elem);
+ mapinfodicom.insert ( std::pair<std::string,std::string>(key,strTagValue) );
+ } // for iTag
+
+ vectormapinfodicom.push_back( mapinfodicom );
+ } // for iitt
+ bbSetOutputDicomInfo( vectormapinfodicom );
+
if (reader!=NULL)
{
reader->Delete();
reader->Update();
reader->GetOutput();
-printf("EED GetXCoherentInfoGdcmReader::Process \n");
bbSetOutputOut( reader->GetOutput() );
}
#endif
#include "vtkImageData.h"
namespace bbgdcmvtk
{
+ typedef std::map<std::string, std::string> MapInfoDicom;
+ typedef std::vector< MapInfoDicom > VectorMapInfoDicom;
class bbgdcmvtk_EXPORT GetXCoherentInfoGdcmReader
:
public bbtk::AtomicBlackBox
{
+
BBTK_BLACK_BOX_INTERFACE(GetXCoherentInfoGdcmReader,bbtk::AtomicBlackBox);
- BBTK_DECLARE_INPUT(In, std::vector<std::string>);
- BBTK_DECLARE_INPUT(IPPSort, bool);
+ BBTK_DECLARE_INPUT(In , std::vector<std::string>);
+ BBTK_DECLARE_INPUT(IPPSort , bool);
+ BBTK_DECLARE_INPUT(DicomTags , std::vector<std::string>);
- BBTK_DECLARE_OUTPUT(Out, vtkImageData *);
- BBTK_DECLARE_OUTPUT(IPP, std::vector<double>);
- BBTK_DECLARE_OUTPUT(IOP, std::vector<double>);
- BBTK_DECLARE_OUTPUT(PixelSpacing, std::vector<double>);
+ BBTK_DECLARE_OUTPUT(Out , vtkImageData *);
+ BBTK_DECLARE_OUTPUT(IPP , std::vector<double>);
+ BBTK_DECLARE_OUTPUT(IOP , std::vector<double>);
+ BBTK_DECLARE_OUTPUT(PixelSpacing , std::vector<double>);
+ BBTK_DECLARE_OUTPUT(DicomInfo , VectorMapInfoDicom);
BBTK_PROCESS(Process);
void Process();
//=================================================================
// UserBlackBox description
BBTK_BEGIN_DESCRIBE_BLACK_BOX(GetXCoherentInfoGdcmReader,bbtk::AtomicBlackBox);
-BBTK_NAME("GetXCoherentInfoGdcmReader");
-BBTK_AUTHOR("jpr, eduardo");
-BBTK_DESCRIPTION("Get Dicom info from a File Set (a list of Dicom image file names) and read (as a vtkImageData)");
-BBTK_CATEGORY("");
-
-BBTK_INPUT(GetXCoherentInfoGdcmReader,In, "List of Dicom image file names", std::vector<std::string>,"");
-BBTK_INPUT(GetXCoherentInfoGdcmReader,IPPSort,"Sort on Image Position Patient",bool,"");
-
-BBTK_OUTPUT(GetXCoherentInfoGdcmReader,Out, "Output image", vtkImageData *,"");
-BBTK_OUTPUT(GetXCoherentInfoGdcmReader,IPP, "Image Position (Patient)", std::vector<double>,"");
-BBTK_OUTPUT(GetXCoherentInfoGdcmReader,IOP, "Image Orientation (Patient)", std::vector<double>,"");
-BBTK_OUTPUT(GetXCoherentInfoGdcmReader,PixelSpacing,"Pixel Spacing", std::vector<double>,"");
+ BBTK_NAME("GetXCoherentInfoGdcmReader");
+ BBTK_AUTHOR("jpr, eduardo");
+ BBTK_DESCRIPTION("Get Dicom info from a File Set (a list of Dicom image file names) and read (as a vtkImageData)");
+ BBTK_CATEGORY("");
+
+ BBTK_INPUT(GetXCoherentInfoGdcmReader,In ,"List of Dicom image file names", std::vector<std::string>,"");
+ BBTK_INPUT(GetXCoherentInfoGdcmReader,IPPSort ,"Sort on Image Position Patient", bool,"");
+ BBTK_INPUT(GetXCoherentInfoGdcmReader,DicomTags ,"Dicom Tags (vector of Dicom tags ex: D0028_0030 D0020_0037)", std::vector<std::string>,"");
+
+ BBTK_OUTPUT(GetXCoherentInfoGdcmReader,Out ,"Output image" , vtkImageData *,"");
+ BBTK_OUTPUT(GetXCoherentInfoGdcmReader,IPP ,"Image Position (Patient)" , std::vector<double>,"");
+ BBTK_OUTPUT(GetXCoherentInfoGdcmReader,IOP ,"Image Orientation (Patient)" , std::vector<double>,"");
+ BBTK_OUTPUT(GetXCoherentInfoGdcmReader,PixelSpacing ,"Pixel Spacing" , std::vector<double>,"");
+ BBTK_OUTPUT(GetXCoherentInfoGdcmReader,DicomInfo ,"vector of maps of Dicom tags" , VectorMapInfoDicom,"");
BBTK_END_DESCRIBE_BLACK_BOX(GetXCoherentInfoGdcmReader);
} // EO namespace bbgdcmvtk
--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
+# - /tmpEED/creaTools/creatools_source/bbtk/packages/std/bbs/appli/exampleSetElementVector.bbg
+# ----------------------------------
+
+APP_START
+CATEGORY:<VOID>
+DESCRIPTION:Description ??
+AUTHOR:Author ??
+COMPLEXBOX:FALSE
+COMPLEXINPUTS:0
+BOXES:5
+BOX
+std:GetVectorStringPointer:Box01
+ISEXEC:FALSE
+6.522014:14.475352:-900.000000
+77.697014:4.475352:-900.000000
+PORT
+In:"A B C D E"
+FIN_BOX
+BOX
+std:SetElementVectorVectorString:Box02
+ISEXEC:FALSE
+-11.680621:-19.993209:-900.000000
+59.494379:-29.993209:-900.000000
+PORT
+I:"2"
+PORT
+Value:"2"
+FIN_BOX
+BOX
+wx:OutputText:Box03
+ISEXEC:FALSE
+-54.917469:-70.666633:-900.000000
+-9.342469:-80.666633:-900.000000
+FIN_BOX
+BOX
+wx:LayoutSplit:Box04
+ISEXEC:TRUE
+-73.506336:-93.307343:-900.000000
+-27.931336:-103.307343:-900.000000
+FIN_BOX
+BOX
+wx:Slider:Box05
+ISEXEC:FALSE
+-59.907189:56.689901:-900.000000
+-8.507189:46.689901:-900.000000
+PORT
+ReactiveOnTrack:"true"
+FIN_BOX
+CONNECTIONS:7
+CONNECTION
+Box05:Widget:Box04:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box05:BoxChange:Box03:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box05:BoxChange:Box02:BoxExecute
+NumberOfControlPoints:0
+CONNECTION
+Box05:Out:Box02:Value
+NumberOfControlPoints:0
+CONNECTION
+Box03:Widget:Box04:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box01:PVec:Box02:PVec
+NumberOfControlPoints:0
+CONNECTION
+Box02:Vec:Box03:In
+NumberOfControlPoints:0
+APP_END
--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBS BlackBox Script
+# - /tmpEED/creaTools/creatools_source/bbtk/packages/std/bbs/appli/exampleSetElementVector.bbs
+# ----------------------------------
+
+# BBTK GEditor Script
+# ----------------------
+
+include std
+include itkvtk
+include std
+include wx
+
+author "Author ??"
+description "Description ??"
+category "<VOID>"
+
+new std:GetVectorStringPointer Box01
+ set Box01.In "A B C D E"
+
+new std:SetElementVectorVectorString Box02
+ set Box02.I "2"
+ set Box02.Value "2"
+
+new wx:OutputText Box03
+
+new wx:LayoutSplit Box04
+
+new wx:Slider Box05
+ set Box05.ReactiveOnTrack "true"
+
+
+connect Box05.Widget Box04.Widget1
+
+connect Box05.BoxChange Box03.BoxExecute
+
+connect Box05.BoxChange Box02.BoxExecute
+
+connect Box05.Out Box02.Value
+
+connect Box03.Widget Box04.Widget2
+
+connect Box01.PVec Box02.PVec
+
+connect Box02.Vec Box03.In
+
+
+
+# Complex input ports
+exec Box04
--- /dev/null
+/*
+ # ---------------------------------------------------------------------
+ #
+ # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+ # pour la SantÈ)
+ # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+ # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+ # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+ #
+ # This software is governed by the CeCILL-B license under French law and
+ # abiding by the rules of distribution of free software. You can use,
+ # modify and/ or redistribute the software under the terms of the CeCILL-B
+ # license as circulated by CEA, CNRS and INRIA at the following URL
+ # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+ # or in the file LICENSE.txt.
+ #
+ # As a counterpart to the access to the source code and rights to copy,
+ # modify and redistribute granted by the license, users are provided only
+ # with a limited warranty and the software's author, the holder of the
+ # economic rights, and the successive licensors have only limited
+ # liability.
+ #
+ # The fact that you are presently reading this means that you have had
+ # knowledge of the CeCILL-B license and that you accept its terms.
+ # ------------------------------------------------------------------------ */
+
+
+/*=========================================================================
+ Program: bbtk
+ Module: $RCSfile: bbstdGetVectorElement.cxx,v $
+ Language: C++
+ Date: $Date: 2012/11/16 08:51:32 $
+ Version: $Revision: 1.4 $
+=========================================================================*/
+
+
+#include "bbstdGetVectorPointer.h"
+#include "bbstdPackage.h"
+
+
+namespace bbstd
+{
+ //====================================================================
+ BBTK_BLACK_BOX_TEMPLATE_IMPLEMENTATION(GetVectorPointer,
+ bbtk::AtomicBlackBox);
+ //====================================================================
+
+//====================================================================
+// Add the specialized boxes to the package
+
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorPointer,int8_t);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorPointer,uint8_t);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorPointer,int16_t);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorPointer,uint16_t);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorPointer,int32_t);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorPointer,uint32_t);
+///\todo : diff between uint32_t and long?
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorPointer,long);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorPointer,float);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorPointer,double);
+typedef std::string string;
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorPointer,string);
+//====================================================================
+
+} // namespace bbstd
--- /dev/null
+/*
+ # ---------------------------------------------------------------------
+ #
+ # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+ # pour la SantÈ)
+ # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+ # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+ # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+ #
+ # This software is governed by the CeCILL-B license under French law and
+ # abiding by the rules of distribution of free software. You can use,
+ # modify and/ or redistribute the software under the terms of the CeCILL-B
+ # license as circulated by CEA, CNRS and INRIA at the following URL
+ # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+ # or in the file LICENSE.txt.
+ #
+ # As a counterpart to the access to the source code and rights to copy,
+ # modify and redistribute granted by the license, users are provided only
+ # with a limited warranty and the software's author, the holder of the
+ # economic rights, and the successive licensors have only limited
+ # liability.
+ #
+ # The fact that you are presently reading this means that you have had
+ # knowledge of the CeCILL-B license and that you accept its terms.
+ # ------------------------------------------------------------------------ */
+
+
+/*=========================================================================
+ Program: bbtk
+ Module: $RCSfile: bbstdGetVectorElement.h,v $
+ Language: C++
+ Date: $Date: 2012/11/16 08:51:32 $
+ Version: $Revision: 1.9 $
+=========================================================================*/
+
+
+#ifndef __bbstdGetVectorPointer_INCLUDED_h__
+#define __bbstdGetVectorPointer_INCLUDED_h__
+
+#include "bbtkAtomicBlackBox.h"
+#include "bbstd_EXPORT.h"
+
+namespace bbstd
+{
+ //=================================================================
+ // BlackBox declaration
+ template <class T>
+ class bbstd_EXPORT GetVectorPointer : public bbtk::AtomicBlackBox
+ {
+ BBTK_TEMPLATE_BLACK_BOX_INTERFACE(GetVectorPointer,bbtk::AtomicBlackBox,T);
+ BBTK_DECLARE_INPUT(In,std::vector<T>);
+ BBTK_DECLARE_OUTPUT(PVec,std::vector<T>*);
+ BBTK_PROCESS(DoIt);
+ void DoIt();
+ std::vector<T> vec;
+ };
+ //=================================================================
+
+ //=================================================================
+ // BlackBox description
+ BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX(GetVectorPointer,bbtk::AtomicBlackBox);
+ BBTK_NAME("Get"+bbtk::HumanTypeName<std::vector<T> >()+"Pointer");
+ BBTK_AUTHOR("info-dev@creatis.insa-lyon.fr");
+ // BBTK_DEFAULT_ADAPTOR();
+ BBTK_DESCRIPTION("Gets the the pointer of the input vector ("+bbtk::TypeName<std::vector<T> >());
+ typedef std::vector<T> Tvector;
+ BBTK_TEMPLATE_INPUT(GetVectorPointer, In,"Input",Tvector);
+// BBTK_TEMPLATE_INPUT(GetVectorPointer, I, "Input",int);
+// BBTK_TEMPLATE_INPUT(GetVectorPointer, ErrorValue, "ErrorValue",T);
+// BBTK_TEMPLATE_OUTPUT(GetVectorPointer,Out,"Output",T);
+ BBTK_TEMPLATE_OUTPUT(GetVectorPointer,PVec,"Output Pointer Vector",std::vector<T>*);
+ BBTK_END_DESCRIBE_TEMPLATE_BLACK_BOX(GetVectorPointer);
+ //=================================================================
+
+ //=================================================================
+ template <class T>
+ void GetVectorPointer<T>::DoIt()
+ {
+ vec = bbGetInputIn();
+ bbSetOutputPVec( &vec );
+ }
+ //=================================================================
+
+ //=================================================================
+ template <class T>
+ void GetVectorPointer<T>::bbUserSetDefaultValues()
+ {
+
+ }
+ //=================================================================
+ //=================================================================
+ template <class T>
+ void GetVectorPointer<T>::bbUserInitializeProcessing()
+ {
+
+ }
+ //=================================================================
+ //=================================================================
+ template <class T>
+ void GetVectorPointer<T>::bbUserFinalizeProcessing()
+ {
+
+ }
+ //=================================================================
+
+} // namespace bbstd
+
+#endif //__bbstdGetVectorPointer_INCLUDED_h__
+
void MixingVectors::Process()
{
// THE MAIN PROCESSING METHOD BODY
- int size1 = bbGetInputIn1().size();
- int size2 = bbGetInputIn2().size();
- int size3 = bbGetInputIn3().size();
- int size4 = bbGetInputIn4().size();
- int size5 = bbGetInputIn5().size();
- int size6 = bbGetInputIn6().size();
- int size7 = bbGetInputIn7().size();
- int size8 = bbGetInputIn8().size();
- int size9 = bbGetInputIn9().size();
- int size10 = bbGetInputIn10().size();
- std::vector<double> outputVector;
-
- for (int i = 0; i < size1; i++)
- {
+ int size1 = bbGetInputIn1().size();
+ int size2 = bbGetInputIn2().size();
+ int size3 = bbGetInputIn3().size();
+ int size4 = bbGetInputIn4().size();
+ int size5 = bbGetInputIn5().size();
+ int size6 = bbGetInputIn6().size();
+ int size7 = bbGetInputIn7().size();
+ int size8 = bbGetInputIn8().size();
+ int size9 = bbGetInputIn9().size();
+ int size10 = bbGetInputIn10().size();
+ std::vector<double> outputVector;
+ for (int i = 0; i < size1; i++)
+ {
outputVector.push_back( bbGetInputIn1()[i] );
- if (i < size2)
- outputVector.push_back( bbGetInputIn2()[i] );
- if (i < size3)
- outputVector.push_back( bbGetInputIn3()[i] );
- if (i < size4)
- outputVector.push_back( bbGetInputIn4()[i] );
- if (i < size5)
- outputVector.push_back( bbGetInputIn5()[i] );
- if (i < size6)
- outputVector.push_back( bbGetInputIn6()[i] );
- if (i < size7)
- outputVector.push_back( bbGetInputIn7()[i] );
- if (i < size8)
- outputVector.push_back( bbGetInputIn8()[i] );
- if (i < size9)
- outputVector.push_back( bbGetInputIn9()[i] );
- if (i < size10)
- outputVector.push_back( bbGetInputIn10()[i] );
+ if (i < size2) { outputVector.push_back( bbGetInputIn2()[i] ); }
+ if (i < size3) { outputVector.push_back( bbGetInputIn3()[i] ); }
+ if (i < size4) { outputVector.push_back( bbGetInputIn4()[i] ); }
+ if (i < size5) { outputVector.push_back( bbGetInputIn5()[i] ); }
+ if (i < size6) { outputVector.push_back( bbGetInputIn6()[i] ); }
+ if (i < size7) { outputVector.push_back( bbGetInputIn7()[i] ); }
+ if (i < size8) { outputVector.push_back( bbGetInputIn8()[i] ); }
+ if (i < size9) { outputVector.push_back( bbGetInputIn9()[i] ); }
+ if (i < size10) { outputVector.push_back( bbGetInputIn10()[i] ); }
}
-
bbSetOutputOut(outputVector);
}
{
}
-}
-// EO namespace bbstd
+
+} // EO namespace bbstd
--- /dev/null
+/*
+ # ---------------------------------------------------------------------
+ #
+ # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+ # pour la SantÈ)
+ # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+ # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+ # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+ #
+ # This software is governed by the CeCILL-B license under French law and
+ # abiding by the rules of distribution of free software. You can use,
+ # modify and/ or redistribute the software under the terms of the CeCILL-B
+ # license as circulated by CEA, CNRS and INRIA at the following URL
+ # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+ # or in the file LICENSE.txt.
+ #
+ # As a counterpart to the access to the source code and rights to copy,
+ # modify and redistribute granted by the license, users are provided only
+ # with a limited warranty and the software's author, the holder of the
+ # economic rights, and the successive licensors have only limited
+ # liability.
+ #
+ # The fact that you are presently reading this means that you have had
+ # knowledge of the CeCILL-B license and that you accept its terms.
+ # ------------------------------------------------------------------------ */
+
+
+/*=========================================================================
+ Program: bbtk
+ Module: $RCSfile: bbstdGetVectorElement.cxx,v $
+ Language: C++
+ Date: $Date: 2012/11/16 08:51:32 $
+ Version: $Revision: 1.4 $
+=========================================================================*/
+
+
+#include "bbstdSetElementVector.h"
+#include "bbstdPackage.h"
+
+
+namespace bbstd
+{
+ //====================================================================
+ BBTK_BLACK_BOX_TEMPLATE_IMPLEMENTATION(SetElementVector,
+ bbtk::AtomicBlackBox);
+ //====================================================================
+
+//====================================================================
+// Add the specialized boxes to the package
+
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,SetElementVector,int8_t);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,SetElementVector,uint8_t);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,SetElementVector,int16_t);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,SetElementVector,uint16_t);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,SetElementVector,int32_t);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,SetElementVector,uint32_t);
+///\todo : diff between uint32_t and long?
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,SetElementVector,long);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,SetElementVector,float);
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,SetElementVector,double);
+typedef std::string string;
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,SetElementVector,string);
+//====================================================================
+
+} // namespace bbstd
--- /dev/null
+/*
+ # ---------------------------------------------------------------------
+ #
+ # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+ # pour la SantÈ)
+ # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+ # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+ # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+ #
+ # This software is governed by the CeCILL-B license under French law and
+ # abiding by the rules of distribution of free software. You can use,
+ # modify and/ or redistribute the software under the terms of the CeCILL-B
+ # license as circulated by CEA, CNRS and INRIA at the following URL
+ # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+ # or in the file LICENSE.txt.
+ #
+ # As a counterpart to the access to the source code and rights to copy,
+ # modify and redistribute granted by the license, users are provided only
+ # with a limited warranty and the software's author, the holder of the
+ # economic rights, and the successive licensors have only limited
+ # liability.
+ #
+ # The fact that you are presently reading this means that you have had
+ # knowledge of the CeCILL-B license and that you accept its terms.
+ # ------------------------------------------------------------------------ */
+
+
+/*=========================================================================
+ Program: bbtk
+ Module: $RCSfile: bbstdGetVectorElement.h,v $
+ Language: C++
+ Date: $Date: 2012/11/16 08:51:32 $
+ Version: $Revision: 1.9 $
+=========================================================================*/
+
+
+#ifndef __bbstdSetElementVector_INCLUDED_h__
+#define __bbstdSetElementVector_INCLUDED_h__
+
+#include "bbtkAtomicBlackBox.h"
+#include "bbstd_EXPORT.h"
+
+namespace bbstd
+{
+ //=================================================================
+ // BlackBox declaration
+ template <class T>
+ class bbstd_EXPORT SetElementVector : public bbtk::AtomicBlackBox
+ {
+ BBTK_TEMPLATE_BLACK_BOX_INTERFACE(SetElementVector,bbtk::AtomicBlackBox,T);
+ BBTK_DECLARE_INPUT(PVec,std::vector<T>*);
+ BBTK_DECLARE_INPUT(I,int);
+ BBTK_DECLARE_INPUT(Value,T);
+ BBTK_DECLARE_OUTPUT(Vec,std::vector<T>);
+ BBTK_PROCESS(DoIt);
+ void DoIt();
+ };
+ //=================================================================
+
+ //=================================================================
+ // BlackBox description
+ BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX(SetElementVector,bbtk::AtomicBlackBox);
+ BBTK_NAME("SetElementVector"+bbtk::HumanTypeName<std::vector<T> >());
+ BBTK_AUTHOR("info-dev@creatis.insa-lyon.fr");
+ // BBTK_DEFAULT_ADAPTOR();
+ BBTK_DESCRIPTION("Sets the value of the i-element ("+bbtk::TypeName<std::vector<T> >());
+ typedef std::vector<T>* pTvector;
+ BBTK_TEMPLATE_INPUT(SetElementVector, PVec,"Pointer to Vector",pTvector);
+ BBTK_TEMPLATE_INPUT(SetElementVector, I, "id-element",int);
+ BBTK_TEMPLATE_INPUT(SetElementVector, Value, "Input Value",T);
+ BBTK_TEMPLATE_OUTPUT(SetElementVector,Vec,"Output Vector",std::vector<T>);
+ BBTK_END_DESCRIBE_TEMPLATE_BLACK_BOX(SetElementVector);
+ //=================================================================
+
+ //=================================================================
+ template <class T>
+ void SetElementVector<T>::DoIt()
+ {
+ if ( (bbGetInputI()>=0) && (bbGetInputI()<bbGetInputPVec()->size()) )
+ {
+ (*( bbGetInputPVec() ))[ bbGetInputI() ] = bbGetInputValue();
+ }
+ bbSetOutputVec( *( bbGetInputPVec() ) );
+// bbSignalOutputModification(std::string("Vec"));
+ }
+ //=================================================================
+
+ //=================================================================
+ template <class T>
+ void SetElementVector<T>::bbUserSetDefaultValues()
+ {
+
+ }
+ //=================================================================
+ //=================================================================
+ template <class T>
+ void SetElementVector<T>::bbUserInitializeProcessing()
+ {
+
+ }
+ //=================================================================
+ //=================================================================
+ template <class T>
+ void SetElementVector<T>::bbUserFinalizeProcessing()
+ {
+
+ }
+ //=================================================================
+
+} // namespace bbstd
+
+#endif //__bbstdSetElementVector_INCLUDED_h__
+
void SharedMemory::bbUserSetDefaultValues()
{
- mCanSet = true;
+ mCanSet = true;
+ firsttime = true;
}
void SharedMemory::bbUserInitializeProcessing()
{
void SharedMemory::DoProcess()
{
mCanSet = true;
+ if (firsttime==true)
+ {
+ firsttime = false;
+ bbSetOutputOut( bbGetInputIn() );
+ }
}
BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,SharedMemory);
public bbtk::AtomicBlackBox
{
BBTK_BLACK_BOX_INTERFACE(SharedMemory,bbtk::AtomicBlackBox);
+
+// BBTK_DECLARE_INPUT(In,bbtk::Data);
BBTK_MB_DECLARE_INPUT(In,bbtk::Data);
+
BBTK_MB_DECLARE_INPUT(In1,bbtk::Data);
BBTK_MB_DECLARE_INPUT(In2,bbtk::Data);
BBTK_MB_DECLARE_INPUT(In3,bbtk::Data);
virtual void bbSetStatusAndPropagate(bbtk::BlackBoxInputConnector* c,
bbtk::IOStatus s);
bool mCanSet;
+ bool firsttime;
};
//==================================================================
std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
// Find first "non-delimiter".
std::string::size_type pos = str.find_first_of(delimiters, lastPos);
- bbmOutputOut.clear();
+// bbmOutputOut.clear();
+std::vector<T> out;
while (std::string::npos != pos || std::string::npos != lastPos)
{
// Found a token, add it to the vector.
- bbmOutputOut.push_back(
- this->decode_item( str.substr(lastPos, pos - lastPos) ) );
+// bbmOutputOut.push_back( this->decode_item( str.substr(lastPos, pos - lastPos) ) );
+ out.push_back( this->decode_item( str.substr(lastPos, pos - lastPos) ) );
// std::cout << this->bbGetOutputOut().back() << std::endl;
// Skip delimiters. Note the "not_of"
lastPos = str.find_first_not_of(delimiters, pos);
// Find next "non-delimiter"
pos = str.find_first_of(delimiters, lastPos);
}
+bbSetOutputOut (out);
+//bbSignalOutputModification();
// std::cout << "s=" << this->bbGetOutputOut().size() << std::endl;
}
//=================================================================
template <class T>
void StringVectorToNumericalVector<T>::DoIt()
{
- std::cout << "StringVectorToNumericalVector<"<<bbtk::TypeName<T>()<<">::DoIt() start "<<std::endl;
-
typedef T type;
// \TODO :Affecter bbGetInputIn() Ã un std::vector<std::string> // recopie? // JPR
//std::vector<std::string> vect (bbGetInputIn() );
+ bbmOutputOut.clear();
// get a std::string, add it to the <std::vector< >>
int lgt=bbGetInputIn().size();
for (int i=0; i<lgt; i++)
bbmOutputOut.push_back( decode_item( bbGetInputIn()[i]) );
}
// bbmOutputOut.clear(); // ? JPR
-
+
// just to see // JPR
//EED int lgrOut=this->bbGetOutputOut().size();
//EED for (int j=0; j<lgrOut; j++)
//EED }
// end just to see // JPR
- std::cout << "StringVectorToNumericalVector<"<<bbtk::TypeName<T>()<<">::DoIt() end "<<std::endl;
-
}
//=================================================================
// * TYPE is the C++ type of the input/output
// (the one provided in the attribute 'type' of the tag 'input')
- double spc[6];
+ double spc[3];
int dim[3];
int outputformat = VTK_UNSIGNED_SHORT;
else if (bbGetInputOutputFormat()=="VTK_DOUBLE") outputformat = VTK_DOUBLE; // 11
else if (bbGetInputOutputFormat()=="MET_DOUBLE") outputformat = VTK_DOUBLE; // 11
-
spc[0] = bbGetInputSpacing()[0];
spc[1] = bbGetInputSpacing()[1];
spc[2] = bbGetInputSpacing()[2];
-
dim[0] = bbGetInputDimensions()[0];
dim[1] = bbGetInputDimensions()[1];
dim[2] = bbGetInputDimensions()[2];
-
+ if ((dim[0]<=0)||(dim[1]<=0)||(dim[2]<=0))
+ {
+ dim[0]=1;
+ dim[1]=1;
+ dim[2]=1;
+ }
+ if ((spc[0]<=0)||(spc[1]<=0)||(spc[2]<=0))
+ {
+ spc[0]=1;
+ spc[1]=1;
+ spc[2]=1;
+ }
+//EED 2017-12-7
+ if (imageoutput!=NULL)
+ {
+ imageoutput->Delete();
+ }
+ imageoutput = vtkImageData::New();
imageoutput->Initialize();
imageoutput->SetSpacing( spc );
imageoutput->SetDimensions( dim[0], dim[1], dim[2] );
imageoutput->AllocateScalars( outputformat,1 );
#endif
-
int i,j,k;
long sizeBlock;
{
memcpy( imageoutput->GetScalarPointer(0,0,k) ,imageoutput->GetScalarPointer() , sizeBlock );
} // for k
-
+
//EED 2017-01-01 Migration VTK7
#if (VTK_MAJOR_VERSION <= 5)
// but this is where you should allocate the internal/output pointers
// if any
- imageoutput = vtkImageData::New();
+//EED 2017-12-7 imageoutput = vtkImageData::New();
}
//=====
#include "bbvtkImageBoundaries.h"
#include "bbvtkPackage.h"
+#include "creaVtk_MACROS.h"
+
+#include <omp.h>
namespace bbvtk
{
int maxX = ext[1]-ext[0]+1;
int maxY = ext[3]-ext[2]+1;
int maxZ = ext[5]-ext[4]+1;
-
int bXMax = 0;
int bYMax = 0;
int bZMax = 0;
int bYMin = maxY-1;
int bZMin = maxZ-1;
- for (i=0 ; i<maxX ; i++)
+/*
+ #pragma omp parallel for
+ for (int i=0 ; i<maxX ; i++)
{
+ int j;
+ int k;
for (j=0 ; j<maxY ; j++)
{
for (k=0 ; k<maxZ ; k++)
{
- value = bbGetInputIn()->GetScalarComponentAsDouble(i, j, k,0);
+ double value = bbGetInputIn()->GetScalarComponentAsDouble(i, j, k,0);
if ( (value>=bbGetInputLowerValue()) && (value<=bbGetInputUpperValue()) )
{
if (i<bXMin) bXMin=i;
} // for k
} // for j
} // i
-
+*/
+
+ DEF_POINTER_IMAGE_VTK_CREA(vI,ssI,pI,stI,bbGetInputIn())
+ int i;
+ int j;
+ long int index=0;
+ for (int k=0 ; k<maxZ ; k++)
+ {
+ for (j=0 ; j<maxY ; j++)
+ {
+ for (i=0 ; i<maxX ; i++)
+ {
+// double value = bbGetInputIn()->GetScalarComponentAsDouble(i, j, k,0);
+ GETVALUE2_VTK_CREA(vI,pI,stI,index)
+ index++;
+ if ( (vI>=bbGetInputLowerValue()) && (vI<=bbGetInputUpperValue()) )
+ {
+ if (i<bXMin) bXMin=i;
+ if (j<bYMin) bYMin=j;
+ if (k<bZMin) bZMin=k;
+ if (i>bXMax) bXMax=i;
+ if (j>bYMax) bYMax=j;
+ if (k>bZMax) bZMax=k;
+ }
+ } // for k
+ } // for j
+ } // i
std::vector<int> tmpIndex;
std::vector<int> tmpSize;
-
if (bXMin>bXMax){
tmpIndex.push_back(0);
tmpIndex.push_back(0);
tmpSize.push_back(bYMax-bYMin+1);
tmpSize.push_back(bZMax-bZMin+1);
}
-
bbSetOutputIndex(tmpIndex);
bbSetOutputSize(tmpSize);
} else {
printf("bbtk warnning: bbtk:vtk:ImageBoundaries box, Input image (In) not initialized..\n");
}
- printf("bbtk:vtk::ImageBoundaries::Process end\n");
}
//=====
// 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 ImagePlanes::bbUserSetDefaultValues()
{
- bbSetOutputPlaneX(0);
- bbSetOutputPlaneY(0);
- bbSetOutputPlaneZ(0);
- bbSetOutputImageX(0);
- bbSetOutputImageY(0);
- bbSetOutputImageZ(0);
- bbSetInputIn(0);
+ bbSetOutputPlaneX(NULL);
+ bbSetOutputPlaneY(NULL);
+ bbSetOutputPlaneZ(NULL);
+ bbSetOutputImageX(NULL);
+ bbSetOutputImageY(NULL);
+ bbSetOutputImageZ(NULL);
+ bbSetInputIn(NULL);
std::vector<double> vect;
vect.push_back(0);
vect.push_back(0);
//bbSetOutputImage3Pts(planeWidget3Pts->GetResliceOutput());
if(picker != 0)
+ {
picker->UnRegister(NULL);
-
+ }
+
mVtkCallback = VtkCallbackType::New();
mVtkCallback->SetBlackBox(this);
planeWidgetX->AddObserver(vtkCommand::InteractionEvent,mVtkCallback);
//Get the corresponding three points out of the vectors
double origin[3];
- origin[0] = pointsx[0];
- origin[1] = pointsy[0];
- origin[2] = pointsz[0];
+ origin[0] = pointsx[0];
+ origin[1] = pointsy[0];
+ origin[2] = pointsz[0];
double point1[3];
- point1[0] = pointsx[1];
- point1[1] = pointsy[1];
- point1[2] = pointsz[1];
+ point1[0] = pointsx[1];
+ point1[1] = pointsy[1];
+ point1[2] = pointsz[1];
double point2[3];
- point2[0]= pointsx[2];
- point2[1]= pointsy[2];
- point2[2]= pointsz[2];
+ point2[0] = pointsx[2];
+ point2[1] = pointsy[2];
+ point2[2] = pointsz[2];
//With the three points we create the corresponding X, Y and Z vectors all orthogonal to each other
- double* vect1= getNormal(makeVector(origin, point1));
- double* vect2= getNormal(makeVector(origin, point2));
- double* crossp = getCrossProduct(vect1, vect2);
+ double* vect1 = getNormal(makeVector(origin, point1));
+ double* vect2 = getNormal(makeVector(origin, point2));
+ double* crossp = getCrossProduct(vect1, vect2);
- double *newx = getCrossProduct(vect2, crossp);
+ double *newx = getCrossProduct(vect2, crossp);
- int ext[6],factor=0;
+ int ext[6],factor = 0;
bbGetInputIn()->GetExtent(ext);
factor = ext[0]<ext[3]? ext[3] : ext[0];
#endif
//To get the slice of image out of the selected volume
- if (_imageReslicer==NULL){
+ if (_imageReslicer==NULL)
+ {
_imageReslicer = vtkImageReslice::New();
_imageReslicer->SetOutputDimensionality(2);
_transform = vtkTransform::New();
_matrix = vtkMatrix4x4::New();
- }
+ } // if
_imageReslicer->SetInterpolationMode( bbGetInputInterpolation() );
//EED 2017-01-01 Migration VTK7
} // bbGetInputIn
}
- void ImagePlanes::updateInteractor(){
-
- vtkRenderWindowInteractor* interactor = bbGetInputInteractor();
-
- if(interactor){
- bbGetOutputPlaneX()->SetInteractor(interactor);
- bbGetOutputPlaneX()->EnabledOn();
- bbGetOutputPlaneY()->SetInteractor(interactor);
- bbGetOutputPlaneY()->EnabledOn();
- bbGetOutputPlaneZ()->SetInteractor(interactor);
- bbGetOutputPlaneZ()->EnabledOn();
- bbGetOutputPlane3Pts()->SetInteractor(interactor);
- bbGetOutputPlane3Pts()->EnabledOn();
- }
- }
+ void ImagePlanes::updateInteractor()
+ {
+ vtkRenderWindowInteractor* interactor = bbGetInputInteractor();
+ if(interactor)
+ {
+ bbGetOutputPlaneX()->SetInteractor(interactor);
+ bbGetOutputPlaneX()->EnabledOn();
+ bbGetOutputPlaneY()->SetInteractor(interactor);
+ bbGetOutputPlaneY()->EnabledOn();
+ bbGetOutputPlaneZ()->SetInteractor(interactor);
+ bbGetOutputPlaneZ()->EnabledOn();
+ bbGetOutputPlane3Pts()->SetInteractor(interactor);
+ bbGetOutputPlane3Pts()->EnabledOn();
+ } // if
+ }
+
//-----------------------------------------------------------------
- void vtkImageDataPointerRelay::bbUserSetDefaultValues()
+ void vtkImageDataPointerRelay::bbUserSetDefaultValues()
{
}
private:
class VtkCallbackType;
- VtkCallbackType* mVtkCallback;
- vtkImageData* image;
- vtkImageReslice* _imageReslicer;
-
- vtkTransform* _transform;
- vtkMatrix4x4* _matrix;
-
- double* getCrossProduct(double* vect0,double* vect1);
- double getPodoubleProduct(double* vect0,double* vect1);
- double* getNormal(double* vect);
- double getMagnitud(double* vect);
- double* makeVector(double podouble0[3], double podouble1[3]);
- void updateInteractor();
+ VtkCallbackType *mVtkCallback;
+ vtkImageData *image;
+ vtkImageReslice *_imageReslicer;
+
+ vtkTransform *_transform;
+ vtkMatrix4x4 *_matrix;
+
+ double *getCrossProduct(double* vect0,double* vect1);
+ double getPodoubleProduct(double* vect0,double* vect1);
+ double *getNormal(double* vect);
+ double getMagnitud(double* vect);
+ double *makeVector(double podouble0[3], double podouble1[3]);
+ void updateInteractor();
vtkImagePlaneWidget* GetPlaneWidget(unsigned char activationkey, double r, double g, double b, vtkCellPicker* picker);
};
//=====
void ImageVtkProperties::Process()
{
- unsigned int dim;
- int ext[6];
- double spc[3];
- double range[2];
- std::string nametype;
- int numberoOfComponents;
- std::vector<int> vsize;
- std::vector<float> vspacing;
- std::vector<float> vrange;
+ unsigned int dim;
+ int ext[6];
+ double spc[3];
+ double range[2];
+ double origin[3];
+ std::string nametype;
+ int numberoOfComponents;
+ std::vector<int> vsize;
+ std::vector<double> vspacing;
+ std::vector<double> vrange;
+ std::vector<double> vorigin;
if ( bbGetInputIn() )
{
bbGetInputIn()->Modified();
-
//EED 2017-01-01 Migration VTK7
#if (VTK_MAJOR_VERSION <= 5)
bbGetInputIn()->Update();
vsize.push_back(ext[1]-ext[0]+1);
vsize.push_back(ext[3]-ext[2]+1);
vsize.push_back(ext[5]-ext[4]+1);
-
dim = 0;
if (vsize[0]>1) dim++;
if (vsize[1]>1) dim++;
if (vsize[2]>1) dim++;
-
bbGetInputIn()->GetScalarRange(range);
+ bbGetInputIn()->GetOrigin(origin);
numberoOfComponents=bbGetInputIn()->GetNumberOfScalarComponents();
-
bbGetInputIn()->GetSpacing(spc);
for (unsigned int i=0;i<dim;++i)
{
- vspacing.push_back((float)spc[i]);
+ vspacing.push_back( (double)spc[i] );
+ vorigin.push_back( (double)origin[i] );
}
-
- vrange.push_back((float)range[0]);
- vrange.push_back((float)range[1]);
-
+ vrange.push_back((double)range[0]);
+ vrange.push_back((double)range[1]);
if (bbGetInputIn()->GetScalarType()==VTK_BIT) nametype="VTK_BIT"; // 1
if (bbGetInputIn()->GetScalarType()==VTK_CHAR) nametype="VTK_CHAR"; // 2
if (bbGetInputIn()->GetScalarType()==VTK_SIGNED_CHAR) nametype="VTK_SIGNED_CHAR"; // 15
vrange.push_back(0);
nametype = "VOID";
}
- bbSetOutputDimension( dim );
- bbSetOutputSize( vsize );
- bbSetOutputSpacing( vspacing );
- bbSetOutputMinMax( vrange );
- bbSetOutputTypeName( nametype );
- bbSetOutputComponents( numberoOfComponents );
-
+ bbSetOutputDimension ( dim );
+ bbSetOutputOrigin ( vorigin );
+ bbSetOutputSize ( vsize );
+ bbSetOutputSpacing ( vspacing );
+ bbSetOutputMinMax ( vrange );
+ bbSetOutputTypeName ( nametype );
+ bbSetOutputComponents ( numberoOfComponents );
}
//=====
// 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)
// 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(In,vtkImageData*);
+ BBTK_DECLARE_OUTPUT(Origin,std::vector<double>);
BBTK_DECLARE_OUTPUT(Dimension,unsigned int);
- BBTK_DECLARE_OUTPUT(MinMax,std::vector<float>);
+ BBTK_DECLARE_OUTPUT(MinMax,std::vector<double>);
BBTK_DECLARE_OUTPUT(Size,std::vector<int>);
- BBTK_DECLARE_OUTPUT(Spacing,std::vector<float>);
+ BBTK_DECLARE_OUTPUT(Spacing,std::vector<double>);
BBTK_DECLARE_OUTPUT(TypeName,std::string);
BBTK_DECLARE_OUTPUT(Components,int);
BBTK_PROCESS(Process);
BBTK_DESCRIPTION("Image information Dim, Spc, Type, MinMax");
BBTK_CATEGORY("filter");
BBTK_INPUT(ImageVtkProperties,In,"Input image (vtk)",vtkImageData*,"");
+ BBTK_OUTPUT(ImageVtkProperties,Origin,"Origin", std::vector<double> ,"");
BBTK_OUTPUT(ImageVtkProperties,Dimension,"Dimensions 1D 2D 3D",unsigned int,"");
- BBTK_OUTPUT(ImageVtkProperties,MinMax,"Gray level range min and max",std::vector<float>,"");
+ BBTK_OUTPUT(ImageVtkProperties,MinMax,"Gray level range min and max",std::vector<double>,"");
BBTK_OUTPUT(ImageVtkProperties,Size,"Size of the image",std::vector<int>,"");
- BBTK_OUTPUT(ImageVtkProperties,Spacing,"Spacing of the image",std::vector<float>,"");
+ BBTK_OUTPUT(ImageVtkProperties,Spacing,"Spacing of the image",std::vector<double>,"");
BBTK_OUTPUT(ImageVtkProperties,TypeName,"Type format of the image",std::string,"");
BBTK_OUTPUT(ImageVtkProperties,Components,"Number of scalar components",int,"");
BBTK_END_DESCRIBE_BLACK_BOX(ImageVtkProperties);
// * TYPE is the C++ type of the input/output
// (the one provided in the attribute 'type' of the tag 'input')
- if ((bbGetInputImageFix()!=NULL) && (bbGetInputImageMove()!=NULL) )
- {
- if ( bbGetInputImageFix()->GetScalarType()==bbGetInputImageMove()->GetScalarType() )
- {
- // Creating Image
- int dim[3];
- int ext[6];
+ if (bbGetInputActive()==true)
+ {
+ if ( (bbGetInputImageFix()!=NULL) && (bbGetInputImageMove()!=NULL) )
+ {
+ if ( bbGetInputImageFix()->GetScalarType()==bbGetInputImageMove()->GetScalarType() )
+ {
+ // Creating Image
+ int dim[3];
+ int ext[6];
//EED 2017-01-01 Migration VTK7
#if (VTK_MAJOR_VERSION <= 5)
(py>=0) && (pz>=0) &&
(sizeXM>0) )
{
- memcpy( _imageoutput->GetScalarPointer(px,py,pz) , bbGetInputImageMove()->GetScalarPointer(spxM,j,k) , sizeXM );
+ _imageoutput = vtkImageData::New();
+ _imageoutput->Initialize();
+ _imageoutput->SetScalarType( bbGetInputImageFix()->GetScalarType() );
+ _imageoutput->SetSpacing( bbGetInputImageFix()->GetSpacing() );
+ _imageoutput->SetDimensions( dim[0], dim[1], dim[2] );
+ _imageoutput->AllocateScalars();
+ // Duplicating Fix Image
+ long sizeimage = dim[0]*dim[1]*dim[2]*bbGetInputImageFix()->GetScalarSize();
+ memcpy( _imageoutput->GetScalarPointer() , bbGetInputImageFix()->GetScalarPointer() , sizeimage);
+ }
+ if (bbGetInputType()==1)
+ {
+ _imageoutput=bbGetInputImageFix();
}
- } // for j
- } // for k
- _imageoutput->Modified();
- } // If Image Fixe Move the same GetScalarType
- else {
- printf ("ERROR: InversCrop both ImageFixe and ImageMove need the same format.\n");
- }
- } // If Image Fixe Move != NULL
- else {
- printf ("ERROR: InversCrop need ImageFixe and ImageMove to run.\n");
- }
- bbSetOutputOut(_imageoutput);
+
+
+ // Copy the Move Image
+ int j,k;
+ int px,py,pz;
+
+ bbGetInputImageMove()->GetWholeExtent(ext);
+ int dimMoveX = ext[1]-ext[0]+1;
+ int dimMoveY = ext[3]-ext[2]+1;
+ int dimMoveZ = ext[5]-ext[4]+1;
+
+ int spxM = 0; // start px MoveImage
+ int sizeXM = 0; // sizeX MoveImage
+
+ px = bbGetInputOrigin()[0];
+ spxM = 0;
+ if (px<0)
+ {
+ spxM=px*(-1);
+ px=0;
+ }
+ sizeXM = dimMoveX-spxM;
+ if (px+sizeXM>=dim[0]) sizeXM=dim[0]-px;
+ sizeXM=sizeXM*bbGetInputImageFix()->GetScalarSize();
+ for (k=0; k<dimMoveZ; k++)
+ {
+ for (j=0; j<dimMoveY; j++)
+ {
+ py=j+bbGetInputOrigin()[1];
+ pz=k+bbGetInputOrigin()[2];
+ if ( (py<dim[1]) && (pz<dim[2]) &&
+ (py>=0) && (pz>=0) &&
+ (sizeXM>0) )
+ {
+ memcpy( _imageoutput->GetScalarPointer(px,py,pz) , bbGetInputImageMove()->GetScalarPointer(spxM,j,k) , sizeXM );
+ }
+
+ } // for j
+ } // for k
+ _imageoutput->Modified();
+ } // If Image Fixe Move the same GetScalarType
+ else {
+ printf ("ERROR: InversCrop both ImageFixe and ImageMove need the same format.\n");
+ printf (" type ImageFix:%d type ImageMove:%d\n", bbGetInputImageFix()->GetScalarType(), bbGetInputImageMove()->GetScalarType() );
+
+ }
+ } // If Image Fixe Move != NULL
+ else {
+ printf ("ERROR: InversCrop need ImageFixe and ImageMove to run.\n");
+ }
+ bbSetOutputOut(_imageoutput);
+
+ } // if Active
+
}
//=====
//=====
void InversCrop::bbUserSetDefaultValues()
{
-
// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
// Here we initialize the input 'In' to 0
+ bbSetInputActive(true);
bbSetInputType(0);
bbSetInputImageFix(NULL);
bbSetInputImageMove(NULL);
-
std::vector<int> origin;
origin.push_back(0);
origin.push_back(0);
origin.push_back(0);
bbSetInputOrigin(origin);
-
_imageoutput=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)
//=====
+
+ BBTK_DECLARE_INPUT(Active,bool);
BBTK_DECLARE_INPUT(Type,int);
BBTK_DECLARE_INPUT(ImageFix,vtkImageData*);
BBTK_DECLARE_INPUT(ImageMove,vtkImageData*);
BBTK_AUTHOR("InfoDev");
BBTK_DESCRIPTION("Invers Crop, Both images had to have the same format");
BBTK_CATEGORY("");
-
+ BBTK_INPUT(InversCrop,Active,"true/false (default true)",bool,"");
BBTK_INPUT(InversCrop,Type,"(default 0) 0=Create image for the result FixImage+MoveImage, 1=Use the FixImage as output",int,"");
BBTK_INPUT(InversCrop,ImageFix,"Fix Image (necesary). Need same format of ImageMove",vtkImageData*,"");
BBTK_INPUT(InversCrop,ImageMove,"Move Image (necesary). Need same format of ImageFix",vtkImageData*,"");
BBTK_INPUT(InversCrop,Origin,"Position to be put de Move Image (default 0,0,0 )",std::vector<int>,"");
-
BBTK_OUTPUT(InversCrop,Out,"First output",vtkImageData*,"");
-
BBTK_END_DESCRIBE_BLACK_BOX(InversCrop);
//=====
// 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 "bbvtkPolyDataToActor.h"
#include "bbvtkPackage.h"
+
namespace bbvtk
{
BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,PolyDataToActor)
colour.push_back(1.0);
colour.push_back(0.5);
bbSetInputColour(colour);
-
bbSetInputActive(true);
bbSetInputIn(NULL);
bbSetInputRenderer(NULL);
bbSetInputRepresentation(2);
bbSetInputLineWidth(1);
bbSetInputScalarVisibility(false);
-
polydatamapper = NULL;
vtkactor = NULL;
}
#endif
vtkactor->GetProperty()->SetRepresentation( bbGetInputRepresentation() );
+
+ if (bbGetInputRepresentation()==1)
+ {
+ vtkactor->GetProperty()->SetAmbient(1);
+ vtkactor->GetProperty()->SetDiffuse(1);
+ vtkactor->GetProperty()->SetSpecular(0);
+ } else {
+printf("EED WARNNING! PolyDataToActor::DoProcess which is the default values of Ambient, Diffuse, Specular ? \n");
+ }
+
vtkactor->GetProperty()->SetLineWidth( bbGetInputLineWidth() );
vtkactor->GetProperty()->SetColor( bbGetInputColour()[0],
bbGetInputColour()[2] );
vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() );
+
if ( bbGetInputTransform()!=NULL )
{
BBTK_BLACK_BOX_IMPLEMENTATION(SliceImage,bbtk::AtomicBlackBox);
void SliceImage::Process()
{
+
+printf("EED ********************************** bbtk-box vtk:SliceImage (Deprecated)\n");
+printf("EED ********************************** >> use bbtk-box creaMaracasVisu:SliceImage \n");
vtkImageData* original = bbGetInputIn();
if (original == NULL)
BBTK_DESCRIPTION("_description_");
BBTK_CATEGORY("__CATEGORY__");
BBTK_INPUT(SliceImage,In,"3D Image",vtkImageData*,"");
-BBTK_INPUT(SliceImage,Z,"shoice",int,"");
+BBTK_INPUT(SliceImage,Z,"schoice",int,"");
BBTK_OUTPUT(SliceImage,Out,"2D Slice",vtkImageData*,"");
BBTK_OUTPUT(SliceImage,Max,"Maximum",int,"");
BBTK_END_DESCRIBE_BLACK_BOX(SliceImage);
#include "bbvtkPackage.h"
#include <vtkPointData.h>
-
+#include <vtkMath.h>
namespace bbvtk
{
colorLookupTable->SetTableValue( iLookTable , rgba2[0],rgba2[1],rgba2[2],rgba2[3]);
} // for iLookTable
+//EED 2018-06-8 ***********************ARDS Projet***********************************************
+ if (bbGetInputColorType()==2)
+ {
+ int tableSize=256;
+ colorLookupTable = vtkLookupTable::New();
+// colorLookupTable->SetNumberOfTableValues(tableSize);
+ colorLookupTable->SetTableRange(range[0],range[1]);
+// colorLookupTable->SetTableRange(0,11);
+ colorLookupTable->Build();
+
+/*
+ for (unsigned int i = 0; i < tableSize; ++i)
+ {
+ colorLookupTable->SetTableValue(i,
+ vtkMath::Random(.25, 1.0),
+ vtkMath::Random(.25, 1.0),
+ vtkMath::Random(.25, 1.0),
+ 1.0);
+ }
+*/
+
+ double rgba1[4];
+ double rgba2[4];
+ int i,j;
+ for (int iLookTable = 0; iLookTable<tableSize*3; iLookTable++)
+ {
+ i=rand() % tableSize;
+ j=rand() % tableSize;
+ colorLookupTable->GetTableValue(i, rgba1);
+ colorLookupTable->GetTableValue(j, rgba2);
+
+ colorLookupTable->SetTableValue(j, rgba1[0],rgba1[1],rgba1[2],rgba1[3]);
+ colorLookupTable->SetTableValue(i, rgba2[0],rgba2[1],rgba2[2],rgba2[3]);
+ } // for iLookTable
+
+ } // type 2
+
+
+ if (bbGetInputColorType()==3)
+ {
+ int tableSize=13;
+ colorLookupTable = vtkLookupTable::New();
+ colorLookupTable->SetNumberOfTableValues(tableSize);
+ colorLookupTable->SetTableRange(6,range[1]);
+ colorLookupTable->Build();
+
+ colorLookupTable->SetTableValue(0, 1 ,1 ,1 ,1);
+ colorLookupTable->SetTableValue(1, 1 ,0 ,0 ,1);
+ colorLookupTable->SetTableValue(2, 0 ,1 ,0 ,1);
+ colorLookupTable->SetTableValue(3, 0 ,0 ,1 ,1);
+ colorLookupTable->SetTableValue(4, 0 ,1 ,1 ,1);
+ colorLookupTable->SetTableValue(5, 1 ,1 ,0 ,1);
+ colorLookupTable->SetTableValue(6, 1 ,0 ,1 ,1);
+
+ colorLookupTable->SetTableValue(7, 0.5,1 ,1 ,1);
+ colorLookupTable->SetTableValue(8, 1 ,0.5,1 ,1);
+ colorLookupTable->SetTableValue(9, 1 ,1 ,0.5,1);
+
+ colorLookupTable->SetTableValue(10,1 ,0.5,0.5,1);
+ colorLookupTable->SetTableValue(11,0.5,0.5,1 ,1);
+
+ } // type 2
+
+
+
+
}
bbGetInputMesh()->GetPointData()->SetScalars(colors);
int iSelection,
std::string title,
std::vector< std::string > lstIn,
- int typeForm );
+ int typeForm,
+ int sizeX, int sizeY );
~ComboBoxWidget();
void OnComboBoxSelection(int iSelection);
void OnComboBox(wxEvent& event);
void FillItems( int iSelection, std::vector< std::string > lstIn);
+ void VerifyDeselect(int iSelection);
private:
int mTypeForm;
ComboBox *mBox;
- wxListBox *wxlistbox;
- wxChoice *wxchoice;
+ wxItemContainer* itemcontainer;
};
//-------------------------------------------------------------------------
ComboBoxWidget::ComboBoxWidget( ComboBox* box,
- wxWindow *parent,
- int iSelection,
- std::string title,
- std::vector< std::string > lstIn,
- int typeForm)
+ wxWindow *parent,
+ int iSelection,
+ std::string title,
+ std::vector< std::string > lstIn,
+ int typeForm,
+ int sizeX,
+ int sizeY
+ )
:
- wxPanel( parent, -1) ,
+ wxPanel( parent, -1,wxDefaultPosition,wxSize(sizeX,sizeY) ) ,
mBox(box),
mTypeForm(typeForm)
{
wxPanel *panel = this;
- wxlistbox = NULL;
- wxchoice = NULL;
+ itemcontainer = NULL;
int i;
//---------------------------------------------------------------------
}
sizer->AddGrowableCol(0);
panel->SetSizer(sizer);
-
//---------------------------------------------------------------------
- // 1) Creation de wxChoise widget
-
- if (mTypeForm==1)
- {
-
- wxlistbox = new wxListBox ( panel , -1 );
- Connect( wxlistbox->GetId(), wxEVT_COMMAND_CHOICE_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&))&ComboBoxWidget::OnComboBox );
- for (i=0;i<lstIn.size(); i++)
- {
- wxlistbox->Append( bbtk::std2wx( lstIn[i] ) );
- } // for i
- wxlistbox->SetSelection(iSelection);
- sizer->Add( wxlistbox,1,wxGROW );
-
- } else {
-
- wxchoice = new wxChoice ( panel , -1 );
- Connect( wxchoice->GetId(), wxEVT_COMMAND_CHOICE_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&))&ComboBoxWidget::OnComboBox );
- for (i=0;i<lstIn.size(); i++)
- {
- wxchoice->Append( bbtk::std2wx( lstIn[i] ) );
- } // for i
- wxchoice->SetSelection(iSelection);
- sizer->Add( wxchoice,1,wxGROW );
- }
-// panel->SetAutoLayout(true);
-// panel->Layout();
+ if (mTypeForm==1)
+ {
+ wxListBox *wxlistbox = new wxListBox ( panel , -1 , wxDefaultPosition,wxSize(sizeX,sizeY),0, NULL, wxLB_SINGLE );
+ itemcontainer=wxlistbox;
+ sizer->Add( wxlistbox,1,wxEXPAND );
+ Connect( wxlistbox->GetId(),
+ wxEVT_COMMAND_LISTBOX_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&))&ComboBoxWidget::OnComboBox );
+ } else if (mTypeForm==0) {
+ wxChoice *wxchoice = new wxChoice ( panel , -1 );
+ itemcontainer=wxchoice;
+ sizer->Add( wxchoice,1,wxGROW );
+ Connect( wxchoice->GetId(),
+ wxEVT_COMMAND_CHOICE_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&))&ComboBoxWidget::OnComboBox );
+ }
+ for (i=0;i<lstIn.size(); i++)
+ {
+ itemcontainer->Append( bbtk::std2wx( lstIn[i] ) );
+ } // for i
+// itemcontainer->SetSelection(iSelection);
}
- //-------------------------------------------------------------------------
-
+
+ //-------------------------------------------------------------------------
ComboBoxWidget::~ComboBoxWidget()
{
}
+ //--------------------------------------------------------------------------
+ void ComboBoxWidget::VerifyDeselect(int iSelection)
+ {
+ if ((iSelection>=0) && (mBox->bbGetInputDeselect()==true) )
+ {
+ if (mTypeForm==1)
+ {
+ ((wxListBox*)itemcontainer)->Deselect( iSelection );
+ } // if mTypeForm
+ } // if iSelection
+ }
//--------------------------------------------------------------------------
void ComboBoxWidget::OnComboBoxSelection(int iSelection)
{
- mBox->bbSetInputSelection( iSelection );
- mBox->bbSetOutputOut( iSelection );
- mBox->bbSetOutputOutString( bbtk::wx2std( wxchoice->GetString(iSelection) ) );
- mBox->bbSignalOutputModification("Out");
- mBox->bbSignalOutputModification("OutString");
+ if (iSelection>=0)
+ {
+ mBox->bbSetInputSelection( iSelection );
+ mBox->bbSetOutputOut( iSelection );
+ mBox->bbSetOutputOutString( bbtk::wx2std( itemcontainer->GetString(iSelection) ) );
+ mBox->bbSignalOutputModification();
+
+ VerifyDeselect(iSelection);
+
+// mBox->bbSignalOutputModification("Out");
+// mBox->bbSignalOutputModification("OutString");
+ } // if iSelection
}
//--------------------------------------------------------------------------
void ComboBoxWidget::OnComboBox(wxEvent& event)
{
- int iSelection;
- if (mTypeForm==1)
- {
- iSelection = wxlistbox->GetSelection();
- } else {
- iSelection = wxchoice->GetSelection();
- }
- OnComboBoxSelection(iSelection);
+ OnComboBoxSelection( itemcontainer->GetSelection() );
}
//--------------------------------------------------------------------------
- void ComboBoxWidget::FillItems(
- int iSelection,
- std::vector< std::string > lstIn
- )
+ void ComboBoxWidget::FillItems( int iSelection, std::vector< std::string > lstIn )
{
int i;
- if (mTypeForm==1)
- {
- wxlistbox->Clear();
-
- for (i=0;i<lstIn.size(); i++)
- {
- wxlistbox->Append( bbtk::std2wx( lstIn[i] ) );
- } // for i
-
- wxlistbox->SetSelection(iSelection);
- } else {
- wxchoice->Clear();
- for (i=0;i<lstIn.size(); i++)
- {
- wxchoice->Append( bbtk::std2wx( lstIn[i] ) );
- } // for i
- wxchoice->SetSelection(iSelection);
- } // if
+ itemcontainer->Clear();
+ for (i=0;i<lstIn.size(); i++)
+ {
+ itemcontainer->Append( bbtk::std2wx( lstIn[i] ) );
+ } // for i
+ if (iSelection>=0) itemcontainer->SetSelection(iSelection);
}
BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,ComboBox)
w->FillItems( iSelection, bbGetInputIn() );
bbSetInputSelection( iSelection );
bbSetOutputOut( iSelection );
-
int size = bbGetInputIn().size();
if ( (iSelection>0) && ( (size-1)<=iSelection) )
{
bbSetOutputOutString( bbGetInputIn()[ iSelection ] );
- }
-// bbSignalOutputModification("Out");
-// bbSignalOutputModification("OutString");
-}
+ } // if iSelection
+ w->VerifyDeselect(iSelection);
+}
//=====
// 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 ComboBox::CreateWidget(wxWindow* parent)
{
-
-// bbSetOutputWidget( new wxStaticText ( parent , -1 , _T("") ) );
-// bbSetOutputWidget( new wxComboBox ( parent , -1 , _T("ups") ) );
-// bbSetOutputWidget( new wxChoice ( parent , -1 ) );
-
ComboBoxWidget *w = new ComboBoxWidget(
this,
parent,
bbGetInputSelection() ,
bbGetInputTitle(),
bbGetInputIn(),
- bbGetInputForm() );
-
+ bbGetInputForm(),
+ bbGetInputWinWidth(), bbGetInputWinHeight() );
bbSetOutputOut( bbGetInputSelection() );
bbSetOutputOutString( bbGetInputIn()[ bbGetInputSelection() ] );
bbSetOutputWidget( w );
-
-
}
//=====
// 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)
bbSetInputSelection(0);
bbSetInputTitle("");
bbSetInputForm(0);
+ bbSetInputWinWidth(100);
+ bbSetInputWinHeight(200);
+ bbSetInputDeselect(false);
}
//=====
// 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 ComboBox::bbUserInitializeProcessing()
{
-
}
//=====
// 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(Selection, int );
BBTK_DECLARE_INPUT(In,std::vector< std::string >);
BBTK_DECLARE_INPUT(Form, int );
+ BBTK_DECLARE_INPUT(Deselect, bool );
BBTK_DECLARE_OUTPUT(Out, int );
BBTK_DECLARE_OUTPUT(OutString, std::string );
BBTK_PROCESS(Process);
BBTK_INPUT(ComboBox,Selection,"i element to be selected (default 0)",int,"");
BBTK_INPUT(ComboBox,In,"Vector of strings",std::vector< std::string >,"");
BBTK_INPUT(ComboBox,Form,"0 Combobox, 1 List (default 0)",int,"");
-
- BBTK_OUTPUT(ComboBox,Out,"i Item selected",int,"");
- BBTK_OUTPUT(ComboBox,OutString,"string Item selected",std::string,"");
-
+ BBTK_INPUT(ComboBox,Deselect,"(default false) Just for List form",bool,"");
+ BBTK_OUTPUT(ComboBox,Out,"i Item selected",int,"");
+ BBTK_OUTPUT(ComboBox,OutString,"string Item selected",std::string,"");
BBTK_END_DESCRIBE_BLACK_BOX(ComboBox);
//=====
// 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)
: wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL),
mBox(box)
{
-
wxPanel *panel = this;
-
mwxCommandButton = new wxButton( panel, -1, title);
Connect( mwxCommandButton->GetId(), wxEVT_COMMAND_BUTTON_CLICKED ,
(wxObjectEventFunction)
(void (wxPanel::*)(wxEvent&))
&CommandButtonWidget::OnCommandButton );
-
wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
sizer -> Add( mwxCommandButton,1,wxGROW | wxALL,10 );
sizer -> AddGrowableCol(0);
-
panel -> SetSizer(sizer);
panel -> SetAutoLayout(true);
panel -> Layout();
-
}
CommandButtonWidget::~CommandButtonWidget()
{
}
-
void CommandButtonWidget::OnCommandButton( wxEvent& )
{
// Look for the interpreter or the executer if no interpreter
}
I->InterpretLine( ccommand );
pos1=pos2+1;
- pos2 = commandstr.find(";",pos2+1);
-
+ pos2 = commandstr.find(";",pos2+1);
}
-
mBox->UpdateLabel();
mBox->UpdateColour();
mBox->bbSignalOutputModification();
}
-
- //--------------------------------------------------------------------------
-
+ //--------------------------------------------------------------------------
void CommandButtonWidget::SetLabel(wxString title)
{
mwxCommandButton->SetLabel(title);
}
+
//--------------------------------------------------------------------------
-
void CommandButtonWidget::SetColour(wxColour color)
{
mwxCommandButton->SetBackgroundColour(color);
+ mwxCommandButton->Refresh();
+ mwxCommandButton->ClearBackground();
}
(bbGetInputColour()[2]==-1) )
{
wxwidget->SetColour( wxwidget->GetParent()->GetBackgroundColour() );
- }
- else
- {
+ } else {
int r=(int) (255*bbGetInputColour()[0]);
int g=(int) (255*bbGetInputColour()[1]);
int b=(int) (255*bbGetInputColour()[2]);
wxwidget->SetColour( wxColour(r,g,b) );
}
-
}
void CommandButton::UpdateLabel()
--- /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 "bbwxHtmlWindow.h"
+#include "bbwxPackage.h"
+#include <wx/html/htmlwin.h>
+
+namespace bbwx
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,HtmlWindow)
+BBTK_BLACK_BOX_IMPLEMENTATION(HtmlWindow,bbtk::WxBlackBox);
+//=====
+// 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 HtmlWindow::Process()
+{
+ wxHtmlWindow* html = (wxHtmlWindow*)bbGetOutputWidget();
+ html->LoadPage( bbtk::std2wx( bbGetInputFileName() ));
+
+}
+//=====
+// 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 HtmlWindow::CreateWidget(wxWindow* parent)
+{
+ bbSetOutputWidget( new wxHtmlWindow(parent, -1, wxDefaultPosition, wxSize(380, 160), wxHW_SCROLLBAR_AUTO) );
+}
+//=====
+// 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 HtmlWindow::bbUserSetDefaultValues()
+{
+
+}
+//=====
+// 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 HtmlWindow::bbUserInitializeProcessing()
+{
+
+}
+//=====
+// 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 HtmlWindow::bbUserFinalizeProcessing()
+{
+
+}
+}
+// 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)
+//=====
+#ifdef _USE_WXWIDGETS_
+#ifndef __bbwxHtmlWindow_h_INCLUDED__
+#define __bbwxHtmlWindow_h_INCLUDED__
+#include "bbwx_EXPORT.h"
+#include "bbtkWxBlackBox.h"
+
+namespace bbwx
+{
+
+class bbwx_EXPORT HtmlWindow
+ :
+ public bbtk::WxBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(HtmlWindow,bbtk::WxBlackBox);
+//=====
+// 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(FileName,std::string);
+ BBTK_PROCESS(Process);
+ void Process();
+ BBTK_CREATE_WIDGET(CreateWidget);
+ void CreateWidget(wxWindow*);
+//=====
+// 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(HtmlWindow,bbtk::WxBlackBox);
+ BBTK_NAME("HtmlWindow");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("__CategoryBlackBox__");
+ BBTK_INPUT(HtmlWindow,FileName,"Web page (.html)",std::string,"");
+BBTK_END_DESCRIBE_BLACK_BOX(HtmlWindow);
+//=====
+// 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 // __bbwxHtmlWindow_h_INCLUDED__
+#endif // _USE_WXWIDGETS_
+
int GetValue();
void OnRadioButton(wxEvent& event);
+ void AddElements(std::vector<wxString> lstIn, int In, wxString title);
private:
RadioButton *mBox;
int MAX_RADIOBUTTON;
wxRadioButton *mwxRadioButton[10];
+
+ wxFlexGridSizer *sizer;
};
//------------------------------------------------------------------------
wxPanel( parent, -1) ,
mBox(box)
{
- wxPanel *panel = this;
+
+/*
MAX_RADIOBUTTON = lstIn.size();
+ wxPanel *panel = this;
int i;
long style=wxRB_GROUP;
for (i=0;i<MAX_RADIOBUTTON; i++)
if (In==i)
{
mwxRadioButton[i]->SetValue(true);
- }
- else
- {
+ } else {
mwxRadioButton[i]->SetValue(false);
}
Connect( mwxRadioButton[i]->GetId(),
(wxObjectEventFunction)
(void (wxPanel::*)(wxEvent&))
&RadioButtonWidget::OnRadioButton );
- }
- else
- {
+ } else {
mwxRadioButton[i]=NULL;
- }
- }
+ } // if
+ } // for
//---------------------------------------------------------------------
// 2) Insertion of the components in the window
// We use a FlexGridSizer
- wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
+
+//EED 2018-04-18
+// wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
+ sizer = new wxFlexGridSizer(1);
+
if (title!=_T(""))
{
sizer->Add( new wxStaticText(panel,-1, title ) );
// panel->SetAutoLayout(true);
// panel->Layout();
+*/
}
//-------------------------------------------------------------------------
mBox->bbSignalOutputModification("Out");
}
+
+ //--------------------------------------------------------------------------
+ void RadioButtonWidget::AddElements( std::vector<wxString> lstIn ,int In, wxString title)
+ {
+ DestroyChildren();
+
+ MAX_RADIOBUTTON = lstIn.size();
+ wxPanel *panel = this;
+ int i;
+ long style=wxRB_GROUP;
+ for (i=0;i<MAX_RADIOBUTTON; i++)
+ {
+ if ( lstIn[i]!=_T(""))
+ {
+ //---------------------------------------------------------------------
+ // 1) Creation of the components of the widget
+ // Any top level sub-widget must have the panel returned by panel
+ // for parent
+ mwxRadioButton[i] = new wxRadioButton( panel, -1, lstIn[i],wxDefaultPosition, wxDefaultSize, style);
+ style=0;
+ if (In==i)
+ {
+ mwxRadioButton[i]->SetValue(true);
+ } else {
+ mwxRadioButton[i]->SetValue(false);
+ }
+ Connect( mwxRadioButton[i]->GetId(),
+ wxEVT_COMMAND_RADIOBUTTON_SELECTED,
+ (wxObjectEventFunction)
+ (void (wxPanel::*)(wxEvent&))
+ &RadioButtonWidget::OnRadioButton );
+ } else {
+ mwxRadioButton[i]=NULL;
+ } // if
+ } // for
+
+ //---------------------------------------------------------------------
+ // 2) Insertion of the components in the window
+
+ // We use a FlexGridSizer
+
+//EED 2018-04-18
+// wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
+ sizer = new wxFlexGridSizer(1);
+
+ if (title!=_T(""))
+ {
+ sizer->Add( new wxStaticText(panel,-1, title ) );
+ }
+ for (i=0;i<MAX_RADIOBUTTON; i++)
+ {
+ if (mwxRadioButton[i]!=NULL)
+ {
+ sizer->Add( mwxRadioButton[i],1,wxGROW );
+ }
+ }
+ sizer->AddGrowableCol(0);
+ panel->SetSizer(sizer);
+
+// panel->SetAutoLayout(true);
+// panel->Layout();
+
+
+
+ }
+
+
//--------------------------------------------------------------------------
//-------------------------------------------------------------------------
//--------------------------------------------------------------------------
{
bbtkDebugMessageInc("Core",9,"RadioButton::Process()"<<std::endl);
bbtkDebugDecTab("Core",9);
+
+
+ std::vector<wxString> lstIn;
+ lstIn.push_back( bbtk::std2wx(bbGetInputIn0()) );
+ lstIn.push_back( bbtk::std2wx(bbGetInputIn1()) );
+ lstIn.push_back( bbtk::std2wx(bbGetInputIn2()) );
+ lstIn.push_back( bbtk::std2wx(bbGetInputIn3()) );
+ lstIn.push_back( bbtk::std2wx(bbGetInputIn4()) );
+ lstIn.push_back( bbtk::std2wx(bbGetInputIn5()) );
+ lstIn.push_back( bbtk::std2wx(bbGetInputIn6()) );
+ lstIn.push_back( bbtk::std2wx(bbGetInputIn7()) );
+ lstIn.push_back( bbtk::std2wx(bbGetInputIn8()) );
+ lstIn.push_back( bbtk::std2wx(bbGetInputIn9()) );
+
+
+ ( (RadioButtonWidget*)bbGetOutputWidget() )->AddElements(lstIn, bbGetInputIn() , bbtk::std2wx(bbGetInputTitle()) );
+
+
}
/**
RadioButtonWidget *w = new RadioButtonWidget(
this,
// bbGetWxParent(),
- parent,
+ parent,
bbGetInputIn() ,
bbtk::std2wx(bbGetInputTitle()),
lstIn );