# ----------------------------------
# - BBTKGEditor v 1.5 BBG BlackBox Diagram file
-# - /home/davila/Creatis/C23/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbg
+# - /Users/davila/Creatis/C23/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbg
# ----------------------------------
APP_START
PORT
In8:"- Delete group"
PORT
-In9:"Tool - 3 or 4 points to surface"
+In9:"Tool - Create Volume Surface from 3 or 4 points (use Close Spline 2 - Close Surface Off)"
FIN_BOX
BOX
creaMaracasVisu:ShowNPoints_Tools:Box60
PORT
In0:"0 1 2 3 4 5 6 7 8 9 10 11"
PORT
-In1:"1 5 10 20 30 40 50 0 100 110 200 210"
+In1:"1 5 10 20 30 40 50 0 100 110 205 210"
PORT
Type:"2"
FIN_BOX
# ----------------------------------
# - BBTKGEditor v 1.5 BBS BlackBox Script (Complex Box)
-# - /home/davila/Creatis/C23/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbs
+# - /Users/davila/Creatis/C23/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/Mesh_tool_ApplySurface.bbs
# ----------------------------------
include std
set Box58.In6 "----------------------"
set Box58.In7 "+> Insert group after"
set Box58.In8 "- Delete group"
- set Box58.In9 "Tool - 3 or 4 points to surface"
+ set Box58.In9 "Tool - Create Volume Surface from 3 or 4 points (use Close Spline 2 - Close Surface Off)"
new creaMaracasVisu:ShowNPoints_Tools Box60
new std:VectorFilterString Box100
set Box100.In0 "0 1 2 3 4 5 6 7 8 9 10 11"
- set Box100.In1 "1 5 10 20 30 40 50 0 100 110 200 210"
+ set Box100.In1 "1 5 10 20 30 40 50 0 100 110 205 210"
set Box100.Type "2"
new std:ConcatStrings Box101
//=====
void ColorLayerImageView::Process()
{
+ printf("EED ColorLayerImageView::Process Start %s\n", bbGetFullName().c_str());
if (bbGetInputIn()!=NULL) {
if ( !( (bbGetInputWxVtkBaseView()==NULL) && (bbGetInputWxVtkBaseView1()==NULL) && (bbGetInputWxVtkBaseView2()==NULL)) )
{
// firsttime=false;
clivp->SetActive( bbGetInputActive() );
}
+
+ std::vector<double> range = bbGetInputlstRangeForColorBar();
+ std::vector<int> colorbarposition = bbGetInputColorBarPosition();
+ std::vector<double> base_color = bbGetInputlstBaseColor();
+ std::vector<double> grey_level_boundaries = bbGetInputlstGreyLevelBoundaries();
+ std::vector<double> transparence_level_boundaries = bbGetInputlstTransparenceBoundaries();
+
clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 0 , bbGetInputWxVtkBaseView() );
clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 1 , bbGetInputWxVtkBaseView1() );
clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 2 , bbGetInputWxVtkBaseView2() );
- std::vector<double> range = bbGetInputlstRangeForColorBar();
clivp->GetColorLayerImageViewManager()->SetRangeForColorBar( range );
- std::vector<int> colorbarposition = bbGetInputColorBarPosition();
clivp->GetColorLayerImageViewManager()->SetColorBarPosition( colorbarposition );
- std::vector<double> base_color = bbGetInputlstBaseColor();
clivp->GetColorLayerImageViewManager()->SetBaseColors( base_color );
- std::vector<double> grey_level_boundaries = bbGetInputlstGreyLevelBoundaries();
clivp->GetColorLayerImageViewManager()->SetGreyLevelBoundaries( grey_level_boundaries );
- std::vector<double> transparence_level_boundaries = bbGetInputlstTransparenceBoundaries();
clivp->GetColorLayerImageViewManager()->SetBaseTransparence( transparence_level_boundaries );
clivp->GetColorLayerImageViewManager()->SetPlainOrGradientColor( bbGetInputPlainOrGradientColor() );
clivp->SetFittingMode( bbGetInputFittingMode() );
clivp->SetImage( bbGetInputIn() );
+
bbSetOutputNewImage( clivp->GetColorLayerImageViewManager()->GetImageChangeInformation(0) );
bbSetOutputLookupTable( clivp->GetColorLayerImageViewManager()->GetLookupTable(0) );
bbSetOutputOutOpacity( clivp->GetOpacity() );
}// if xxVtkBaseView
} // if In
+
+ printf("EED ColorLayerImageView::Process End \n");
+
}
//=====
// Don't edit this file. This file is generated from xml description..
#include "wxVtkBaseView.h"
#include <vtkScalarsToColors.h>
-
#include <vtkScalarsToColors.h>
-
namespace bbcreaMaracasVisu
{
BBTK_BEGIN_DESCRIBE_BLACK_BOX(ColorLayerImageView,bbtk::WxBlackBox);
BBTK_NAME("ColorLayerImageView");
BBTK_AUTHOR("Eduardo DAVILA (Creatis)");
- BBTK_DESCRIPTION("Color Layer Image View");
+ BBTK_DESCRIPTION("(wxWidget) Color Layer Image View");
BBTK_CATEGORY("__CategoryBlackBox__");
BBTK_INPUT(ColorLayerImageView,In,"Input Image",vtkImageData*,"");
BBTK_INPUT(ColorLayerImageView,Active,"Active True/False (default True)",bool,"");
--- /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 "bbcreaMaracasVisuColorLayerImageView2.h"
+#include "bbcreaMaracasVisuPackage.h"
+namespace bbcreaMaracasVisu
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ColorLayerImageView2)
+BBTK_BLACK_BOX_IMPLEMENTATION(ColorLayerImageView2,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 ColorLayerImageView2::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 (bbGetInputActive()==true)
+ {
+ if (bbGetInputIn()!=NULL) {
+ if ( !( (bbGetInputWxVtkBaseView()==NULL) && (bbGetInputWxVtkBaseView1()==NULL) && (bbGetInputWxVtkBaseView2()==NULL)) )
+ {
+ // ColorLayerImageViewPanel_widgetBox *clivp = (ColorLayerImageViewPanel_widgetBox*)bbGetOutputWidget();
+ // if (clivp!=NULL) {
+
+ // if (firsttime==true)
+ // {
+ // firsttime=false;
+ // clivp->SetActive( bbGetInputActive() );
+ // }
+
+
+ std::vector<double> range = bbGetInputlstRangeForColorBar();
+ std::vector<int> colorbarposition = bbGetInputColorBarPosition();
+ std::vector<double> base_color = bbGetInputlstBaseColor();
+ std::vector<double> grey_level_boundaries = bbGetInputlstGreyLevelBoundaries();
+ std::vector<double> transparence_level_boundaries = bbGetInputlstTransparenceBoundaries();
+
+ _colorLayerImageViewManager->SetwxVtkBaseView ( 0 , bbGetInputWxVtkBaseView() );
+ _colorLayerImageViewManager->SetwxVtkBaseView ( 1 , bbGetInputWxVtkBaseView1() );
+ _colorLayerImageViewManager->SetwxVtkBaseView ( 2 , bbGetInputWxVtkBaseView2() );
+ _colorLayerImageViewManager->SetRangeForColorBar ( range );
+ _colorLayerImageViewManager->SetColorBarPosition ( colorbarposition );
+ _colorLayerImageViewManager->SetBaseColors ( base_color );
+ _colorLayerImageViewManager->SetGreyLevelBoundaries ( grey_level_boundaries );
+ _colorLayerImageViewManager->SetBaseTransparence ( transparence_level_boundaries );
+ _colorLayerImageViewManager->SetPlainOrGradientColor ( bbGetInputPlainOrGradientColor() );
+ _colorLayerImageViewManager->onThresholdChangeOpacity ( bbGetInputOpacity() );
+ _colorLayerImageViewManager->SetActive ( bbGetInputActive() );
+
+ int fitting_mode=3;
+ // CM Sets the fitting mode if an appropriate value is provided.
+ if (bbGetInputFittingMode() == -1 || bbGetInputFittingMode() == 1 || bbGetInputFittingMode() == 2 || bbGetInputFittingMode() == 3)
+ {
+ fitting_mode = bbGetInputFittingMode();
+ }
+ //Otherwise, an exception should be thrown (value 0 is fine, it corresponds to an empty field i.e. the default value is kept).
+ else if (bbGetInputFittingMode() != 0) {
+ std::cout << "CM ERROR!!! The fitting mode provided has an inappropriate value. It should be an int between -1 ; 1 ; 2 ; 3, but its value is :" << bbGetInputFittingMode() << ". The default value will be set instead, i.e. Pixel transformation (3)." << std::endl;
+ //EO CM
+ fitting_mode=3;
+ }
+
+// clivp->SetFittingMode( bbGetInputFittingMode() );
+// clivp->SetImage( bbGetInputIn() );
+ _colorLayerImageViewManager->SetFittingMode( fitting_mode );
+ _colorLayerImageViewManager->SetImageStep1( bbGetInputIn() );
+ _colorLayerImageViewManager->SetImageStep2( bbGetInputIn() );
+
+ bbSetOutputNewImage( _colorLayerImageViewManager->GetImageChangeInformation(0) );
+ bbSetOutputLookupTable( _colorLayerImageViewManager->GetLookupTable(0) );
+// bbSetOutputOutOpacity( clivp->GetOpacity() );
+ // if (firsttime==true)
+ // {
+ // firsttime=false;
+ // clivp->ChangeOpacity();
+ // clivp->SetBox(this);
+ // }
+ // } // if clivp
+ } else {
+ printf("EED Error!!! ColorLayerImageView::Process (%s) Missing Inputs: WxVtkBaseView , WxVtkBaseView1 , WxVtkBaseView2 \n", bbGetFullName().c_str() );
+ }// if xxVtkBaseView
+
+ } // if In
+
+ } // if Active
+
+
+
+}
+//=====
+// 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 ColorLayerImageView2::bbUserSetDefaultValues()
+{
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ firsttime=true;
+ bbSetInputIn(NULL);
+ bbSetInputActive(true);
+ bbSetInputOpacity(100);
+ bbSetInputPlainOrGradientColor(false);
+// bbSetInputTypeControlsInterface(1);
+ bbSetInputWxVtkBaseView(NULL);
+ bbSetInputWxVtkBaseView1(NULL);
+ bbSetInputWxVtkBaseView2(NULL);
+ std::vector<int> lstColorBarPosition;
+ lstColorBarPosition.push_back(10);
+ lstColorBarPosition.push_back(105);
+ bbSetInputColorBarPosition(lstColorBarPosition);
+// bbSetOutputWidget(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 ColorLayerImageView2::bbUserInitializeProcessing()
+{
+
+ _colorLayerImageViewManager = new ColorLayerImageViewManager();
+
+// 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 ColorLayerImageView2::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbcreaMaracasVisu
+
+
--- /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 __bbcreaMaracasVisuColorLayerImageView2_h_INCLUDED__
+#define __bbcreaMaracasVisuColorLayerImageView2_h_INCLUDED__
+
+#include "bbcreaMaracasVisu_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include <vtkScalarsToColors.h>
+#include <vtkScalarsToColors.h>
+
+#include "wxVtkBaseView.h"
+#include "ColorLayerImageViewManager.h"
+
+namespace bbcreaMaracasVisu
+{
+
+class bbcreaMaracasVisu_EXPORT ColorLayerImageView2
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(ColorLayerImageView2,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(In,vtkImageData*);
+ BBTK_DECLARE_INPUT(Active,bool);
+ BBTK_DECLARE_INPUT(Opacity,int);
+// BBTK_DECLARE_INPUT(TypeControlsInterface,int);
+ BBTK_DECLARE_INPUT(WxVtkBaseView,wxVtkBaseView *);
+ BBTK_DECLARE_INPUT(WxVtkBaseView1,wxVtkBaseView *);
+ BBTK_DECLARE_INPUT(WxVtkBaseView2,wxVtkBaseView *);
+ BBTK_DECLARE_INPUT(lstBaseColor,std::vector<double>);
+ BBTK_DECLARE_INPUT(lstGreyLevelBoundaries,std::vector<double>);
+ BBTK_DECLARE_INPUT(lstTransparenceBoundaries,std::vector<double>);
+ BBTK_DECLARE_INPUT(lstRangeForColorBar,std::vector<double>);
+ BBTK_DECLARE_INPUT(PlainOrGradientColor,bool);
+ BBTK_DECLARE_INPUT(FittingMode,int);
+ BBTK_DECLARE_INPUT(ColorBarPosition,std::vector<int>);
+ BBTK_DECLARE_OUTPUT(NewImage,vtkImageData*);
+ BBTK_DECLARE_OUTPUT(LookupTable,vtkScalarsToColors*);
+// BBTK_DECLARE_OUTPUT(OutOpacity,int);
+ BBTK_PROCESS(Process);
+
+ void Process();
+ bool firsttime;
+ ColorLayerImageViewManager *_colorLayerImageViewManager;
+
+//=====
+// 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(ColorLayerImageView2,bbtk::AtomicBlackBox);
+ BBTK_NAME("ColorLayerImageView2");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("Color Layer Image View");
+ BBTK_CATEGORY("empty");
+ BBTK_INPUT(ColorLayerImageView2,In,"Input Image",vtkImageData*,"");
+ BBTK_INPUT(ColorLayerImageView2,Active,"Active True/False (default True)",bool,"");
+ BBTK_INPUT(ColorLayerImageView2,Opacity,"(default 100) 0..100",int,"");
+// BBTK_INPUT(ColorLayerImageView2,TypeControlsInterface,"1 (default) All controls, 2 just transparency",int,"");
+ BBTK_INPUT(ColorLayerImageView2,WxVtkBaseView," 0 creaMaracasVisuViewer viewer XY,YZ ou XZ",wxVtkBaseView*,"");
+ BBTK_INPUT(ColorLayerImageView2,WxVtkBaseView1," 1 creaMaracasVisuViewer viewer XY,YZ ou XZ",wxVtkBaseView*,"");
+ BBTK_INPUT(ColorLayerImageView2,WxVtkBaseView2," 2 creaMaracasVisuViewer viewer XY,YZ ou XZ",wxVtkBaseView*,"");
+ BBTK_INPUT(ColorLayerImageView2,lstBaseColor,"???EED List of Base Colors in RGB format to define the color map. Requirement: must be of a size being a multiple of 3, with values between 0 and 1. For example, for 2 colors: \"1 0 0 0 0 1\". If not provided as required, the histogram is equally split into three areas, blue, yellow and red.",std::vector<double>,"");
+ BBTK_INPUT(ColorLayerImageView2,lstTransparenceBoundaries,"Transparence vector. (The same size of color lst).",std::vector<double>,"");
+ BBTK_INPUT(ColorLayerImageView2,lstGreyLevelBoundaries,"???EED List of the Grey Level Boundaries to define the color map (grey level outside the color boundaries will not be disayed). Requirement: Must have one more element than the number of colours. For example, for 2 colors: \"50 150 250\". If not provided as required, the histogram is equally split into areas, which number corresponds to the number of colors provided (3 by default).",std::vector<double>,"");
+ BBTK_INPUT(ColorLayerImageView2,lstRangeForColorBar,"??? EED ",std::vector<double>,"");
+ BBTK_INPUT(ColorLayerImageView2,PlainOrGradientColor,"true=Plane false=Gradient (Default false)",bool,"");
+ BBTK_INPUT(ColorLayerImageView2,FittingMode,"Choose the fitting mode between the images, the transformation can be either by Dimension (1), by Spacing (2) or by Pixel (3). If you want to make the choice through a dialog box, choose (-1). Default is by Pixel (3).",int,"");
+ BBTK_INPUT(ColorLayerImageView2,ColorBarPosition,"default (10,105)",std::vector<int>,"");
+ BBTK_OUTPUT(ColorLayerImageView2,NewImage,"Image with correct Spacing",vtkImageData*,"");
+ BBTK_OUTPUT(ColorLayerImageView2,LookupTable,"LookupTable",vtkScalarsToColors*,"");
+// BBTK_OUTPUT(ColorLayerImageView2,OutOpacity,"Opacity",int,"");
+BBTK_END_DESCRIBE_BLACK_BOX(ColorLayerImageView2);
+//=====
+// 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 bbcreaMaracasVisu
+
+#endif // __bbcreaMaracasVisuColorLayerImageView2_h_INCLUDED__
+
WidgetShowNPoints* wsp = bbGetInputWidgetShowNPoints();
wsp->StopAutoAddPoints();
wsp->StopTrackPoint();
- if((wsp->GetLstModelShowNPointsSize()==1) && (bbGetInputMesh()!=NULL )){
+ if((wsp->GetLstModelShowNPointsSize()==1) && (bbGetInputMesh()!=NULL ))
+ {
if(wsp->GetModelShowNPoints()->GetLstPointsSize()==4){
CreatePatch_4points();
}
}
else{
printf("PG ShowNPoints_Tools::CreatePatch_Npoints Warning patch not apply. groups or mesh invalid. Need 1 group of 3 or 4 points, and a mesh\n");
- }
+ } // if wsp && mesh
}
+void ShowNPoints_Tools::InitCreateVolumeSurface_Points()
+{
+ InitCreatePatch_Points(); // 1 group -> 3 groups
+
+ // 3 groups to 4 groups
+ WidgetShowNPoints* wsp = bbGetInputWidgetShowNPoints();
+ wsp->StopAutoAddPoints();
+ wsp->StopTrackPoint();
+ if( wsp->GetLstModelShowNPointsSize()==3 )
+ {
+ double spc[3];
+ double pC1[3]; // fist point
+ double dx,dy,dz;
+ double pC2A[3]; // first middle point
+ double pC2B[3]; // second midle point
+ double pC3[3]; // last point
+ double pN[3]; // new over the surface
+
+ vtkPoints *points = bbGetInputMesh()->GetPoints();
+ vtkStaticPointLocator *pointLocator = vtkStaticPointLocator::New();
+ pointLocator->SetDataSet( bbGetInputMesh() );
+ pointLocator->BuildLocator();
+ spc[0] = bbGetInputSpacing()[0];
+ spc[1] = bbGetInputSpacing()[1];
+ spc[2] = bbGetInputSpacing()[2];
+ wsp->InsertCollectionAfter_();
+ wsp->GetCollectionPoint(1,0, pC1);
+ wsp->GetCollectionPoint(1,2, pC3);
+ dx=pC3[0]-pC1[0];
+ dy=pC3[1]-pC1[1];
+ dz=pC3[2]-pC1[2];
+ pC2A[0]=pC1[0]+dx*0.33333; pC2A[1]=pC1[1]+dy*0.3333; pC2A[2]=pC1[2]+dz*0.33333;
+ pC2B[0]=pC1[0]+dx*0.66666; pC2B[1]=pC1[1]+dy*0.6666; pC2B[2]=pC1[2]+dz*0.66666;
+
+ wsp->InsertPoint(pC1[0] ,pC1[1], pC1[2],"");
+
+ NearestPointToMesh(points, pointLocator, spc, pC2A,pN);
+ wsp->InsertPoint(pN[0] ,pN[1], pN[2],"");
+
+ NearestPointToMesh(points, pointLocator, spc, pC2B,pN);
+ wsp->InsertPoint(pN[0] ,pN[1], pN[2],"");
+
+ wsp->InsertPoint(pC3[0] ,pC3[1], pC3[2],"");
+
+ // --- Finish ---
+ wsp->SetOutputBox();
+ wsp->UndoRedo_SaveCollection();
+
+ } // if wsp && mesh
+}
+
+
void ShowNPoints_Tools::CreatePatch_Points(std::vector<double> lstX, std::vector<double> lstY, std::vector<double> lstZ)
{
WidgetShowNPoints* wsp = bbGetInputWidgetShowNPoints();
}
NearestPointToMesh(points, pointLocator, spc, p,pM);
wsp->InsertPoint(pM[0] ,pM[1], pM[2],"");
-
if(sect == 0 || sect == 4) lstIdNormalSurface.push_back( pointLocator->FindClosestPoint(pM) );
}
wsp->InsertPoint(p[0] ,p[1], p[2],"");
std::copy(std::begin(p), std::end(p), std::begin(centroid));
// --- Group 2 ---
-
wsp->InsertCollectionAfter_();
-
dx = lstX[2]-lstX[3];
dy = lstY[2]-lstY[3];
dz = lstZ[2]-lstZ[3];
}
NearestPointToMesh(points, pointLocator, spc, p,pM);
wsp->InsertPoint(pM[0] ,pM[1], pM[2],"");
-
if(sect == 0 || sect == 4) lstIdNormalSurface.push_back( pointLocator->FindClosestPoint(pM) );
}
-
pointLocator->Delete();
-
// Check normals
// 1. Recorrer las normales de lstIdNormals y calcular el promedio -> V1
double *nValue;
{
bbGetInputWidgetShowNPoints()->OnResetCollections_();
} // if Type
- if (bbGetInputType()==200)
+ if (bbGetInputType()==200) // Create patch surface
{
InitCreatePatch_Points();
} // if Type
+ if (bbGetInputType()==205) // Create volume surface from points
+ {
+ InitCreateVolumeSurface_Points();
+ } // if Type
if (bbGetInputType()==210)
{
bbGetInputWidgetShowNPoints()->OnInvertLstPoints_();
void CreatePatch_3points();
void CreatePatch_4points();
void InitCreatePatch_Points();
+ void InitCreateVolumeSurface_Points();
void CreatePatch_Points(std::vector<double> lstX, std::vector<double> lstY, std::vector<double> lstZ);
void NearestPointToMesh( vtkPoints *points, vtkStaticPointLocator *pointLocator, double *spc , double *p , double *pM );
void MovePatchCenter();
BBTK_INPUT(ShowNPoints_Tools,WidgetShowNPoints,"WidgetShowNPoints",WidgetShowNPoints*,"");
BBTK_INPUT(ShowNPoints_Tools,Spacing,"(default [1,1,1] )Spacing",std::vector<double>,"");
BBTK_INPUT(ShowNPoints_Tools,Mesh,"Mesh en format vtkPolyData ",vtkPolyData*,"");
- BBTK_INPUT(ShowNPoints_Tools,Type,"(default 0) 0:Nothing 1:Auto add poits 5:Add Point 10:Insert Point 20:TrackPoint 30:Set nearest point 40:Erase point 50:Deleta all points 100:Insert group after 110:Delete group 120:Reset colletion 200:Tool 3 or 4 points to surface - Create Mesh (based on one group and 3 or 4 points) 210: Invert points 220: Move patch center 300: Create expanded surface 310: Create wide expanded surface 320: Expand Surface, 330: Widen surface, 340: Expand patch",int,"");
+ BBTK_INPUT(ShowNPoints_Tools,Type,"(default 0) 0:Nothing 1:Auto add poits 5:Add Point 10:Insert Point 20:TrackPoint 30:Set nearest point 40:Erase point 50:Deleta all points 100:Insert group after 110:Delete group 120:Reset colletion 200:Tool 3 or 4 points to patch surface - Create Mesh (based on 1 group and 3 or 4 points) 205:Tool 3 or 4 points to volume surface - Create Mesh (based on 1 group and 3 or 4 points) 210: Invert points 220: Move patch center 300: Create expanded surface 310: Create wide expanded surface 320: Expand Surface, 330: Widen surface, 340: Expand patch",int,"");
BBTK_INPUT(ShowNPoints_Tools, Params,"Optional params for the tools, required for 200: normal and direction, 320: centroid and direction, 330: normal and direction, 340: centroid and direction", std::vector<double>,"");
BBTK_OUTPUT(ShowNPoints_Tools, Out, "Output", std::vector<double>, "");
//=========================================================================
ColorLayerImageViewManager::ColorLayerImageViewManager( )
{
+ _active = true;
+ _fitting_mode = 3;
_colorLayerImageViewLst.push_back(NULL); // 0
_colorLayerImageViewLst.push_back(NULL); // 1
_colorLayerImageViewLst.push_back(NULL); // 2
}
//----------------------------------------------------------------------------
-void ColorLayerImageViewManager::SetImage( vtkImageData* img )
+void ColorLayerImageViewManager::SetImageStep1( vtkImageData* img )
{
- int i, size=_colorLayerImageViewLst.size();
- for (i=0;i<size;i++)
- {
- if (_colorLayerImageViewLst[i]!=NULL)
- {
- _colorLayerImageViewLst[i]->SetImage( img );
- } // if
- } // for
+ int i, size=_colorLayerImageViewLst.size();
+ for (i=0;i<size;i++)
+ {
+ if (_colorLayerImageViewLst[i]!=NULL)
+ {
+ _colorLayerImageViewLst[i]->SetImage( img );
+ } // if
+ } // for i
+}
+
+//----------------------------------------------------------------------------
+void ColorLayerImageViewManager::SetImageStep2( vtkImageData* img )
+{
+ if (img!=NULL)
+ {
+// if (_histogramMinMaxLevel!=NULL)
+// {
+// _histogramMinMaxLevel->Configure( img );
+// }
+// _colorLayerImageViewManager->SetImage( img );
+ double spcOriginalLayer[3];
+ int dimensionOriginalLayer[3];
+ double spcBase[3];
+ int dimensionBase[3];
+ double newSpc[3];
+ this->GetSpcOriginalLayer(0,spcOriginalLayer);
+ this->GetDimensionOriginalLayer(0,dimensionOriginalLayer);
+ this->GetSpcBase(0,spcBase);
+ this->GetDimensionBase(0,dimensionBase);
+// if (_sl_SliceImageX!=NULL)
+// {
+// _sl_SliceImageX->SetRange( 0 , dimensionOriginalLayer[0] );
+// _sl_SliceImageY->SetRange( 0 , dimensionOriginalLayer[1] );
+// _sl_SliceImageZ->SetRange( 0 , dimensionOriginalLayer[2] );
+// }
+
+ if ( (spcOriginalLayer[0]!=spcBase[0]) ||
+ (spcOriginalLayer[1]!=spcBase[1]) ||
+ (spcOriginalLayer[2]!=spcBase[2]) ||
+ (dimensionOriginalLayer[0]!=dimensionBase[0]) ||
+ (dimensionOriginalLayer[1]!=dimensionBase[1]) ||
+ (dimensionOriginalLayer[2]!=dimensionBase[2])
+ )
+ {
+ // CM
+ int typeOfTransformation = _fitting_mode;
+// // In case of the option is set to create a dialog box.
+// if (_fitting_mode == -1)
+// {
+// bool transformOkDlg;
+// wxString msg = _T("The image resolution of both images are not compatible. How do you want to tranform it? ");
+// wxDlgTransformByDimensionBySpacingByPixel dlg;
+// dlg.GetTransformType(this , spcBase , spcOriginalLayer , dimensionBase ,dimensionOriginalLayer ,msg,typeOfTransformation,transformOkDlg);
+// // CM Reset the default value (Pixel i.e. 3) if the dialog box returned an inappropriate value.
+// if (transformOkDlg == false)
+// {
+// typeOfTransformation = 3;
+// }
+// } else {
+// typeOfTransformation = _fitting_mode;
+// } // _fitting_mode -1
+
+ //EO CM
+ if (typeOfTransformation == 1) // Adapt spacing
+ {
+ newSpc[0] = spcBase[0] * dimensionBase[0] / dimensionOriginalLayer[0];
+ newSpc[1] = spcBase[1] * dimensionBase[1] / dimensionOriginalLayer[1];
+ newSpc[2] = spcBase[2] * dimensionBase[2] / dimensionOriginalLayer[2];
+ }
+
+ if (typeOfTransformation == 2) // keep spacing of the Layer Image
+ {
+ newSpc[0] = spcOriginalLayer[0];
+ newSpc[1] = spcOriginalLayer[1];
+ newSpc[2] = spcOriginalLayer[2];
+ }
+
+ if (typeOfTransformation == 3) // Use the spacing of the Base Image
+ {
+ newSpc[0] = spcBase[0];
+ newSpc[1] = spcBase[1];
+ newSpc[2] = spcBase[2];
+ }
+ this->SetNewSpacingLayer(newSpc);
+ } else {
+ newSpc[0] = spcOriginalLayer[0];
+ newSpc[1] = spcOriginalLayer[1];
+ newSpc[2] = spcOriginalLayer[2];
+ } // spc !_spcBase dim!__dimBase
+ this->SetNewSpacingLayer(newSpc);
+ } // img
+
+ if (_active==true)
+ {
+ this->onThreshold();
+ if (img==NULL)
+ {
+ this->onThresholdRemove( );
+ } // img
+ this->Refresh();
+ } // _active
+
}
//----------------------------------------------------------------------------
} // for
}
+//----------------------------------------------------------------------------
+void ColorLayerImageViewManager::SetActive(bool active)
+{
+ _active = active;
+}
+
+//----------------------------------------------------------------------------
+bool ColorLayerImageViewManager::GetActive()
+{
+ return _active;
+}
+
+//----------------------------------------------------------------------------
+void ColorLayerImageViewManager::SetFittingMode( int fitting_mode )
+{
+ _fitting_mode = fitting_mode;
+}
+
+//----------------------------------------------------------------------------
+int ColorLayerImageViewManager::GetFittingMode()
+{
+ return _fitting_mode;
+}
+
// EOF
void onThresholdInterpolation( bool interpolation );
void SetSliceFixDynamic( bool fixdin );
void onThresholdChangeOpacity( int opacity );
+ void SetImageStep1( vtkImageData* img );
+ void SetImageStep2( vtkImageData* img );
void SetImage( vtkImageData* img );
vtkImageData* GetImageChangeInformation(int id);
void GetDimensionOriginalLayer (int id,int *dim);
void GetSpcOriginalLayer (int id,double *spc);
void SetNewSpacingLayer (double *spc);
+ void SetActive (bool active);
+ bool GetActive();
+ void SetFittingMode( int fitting_mode );
+ int GetFittingMode();
vtkLookupTable* GetLookupTable(int id);
private:
std::vector< ColorLayerImageView* > _colorLayerImageViewLst;
-
+ bool _active;
+ int _fitting_mode;
protected:
};
return _colorLayerImageViewManager;
}
+/*
//----------------------------------------------------------------------------
void ColorLayerImageViewPanel::SetImage(vtkImageData *img)
{
{
_histogramMinMaxLevel->Configure( img );
}
+
_colorLayerImageViewManager->SetImage( img );
+
double spcOriginalLayer[3];
int dimensionOriginalLayer[3];
double spcBase[3];
newSpc[1] = spcOriginalLayer[1];
newSpc[2] = spcOriginalLayer[2];
} // spc !_spcBase dim!__dimBase
-
GetColorLayerImageViewManager()->SetNewSpacingLayer(newSpc);
} // img
_colorLayerImageViewManager->onThreshold();
if (img==NULL) _colorLayerImageViewManager->onThresholdRemove( );
RefreshView();
- } // _ative
+ } // _active
+}
+*/
+
+//----------------------------------------------------------------------------
+void ColorLayerImageViewPanel::SetImage(vtkImageData *img)
+{
+// if (img!=NULL)
+// {
+ if (_histogramMinMaxLevel!=NULL)
+ {
+ _histogramMinMaxLevel->Configure( img );
+ }
+
+ _colorLayerImageViewManager->SetImageStep1( img );
+
+ double spcBase[3];
+ double spcOriginalLayer[3];
+ int dimensionBase[3];
+ int dimensionOriginalLayer[3];
+ // double newSpc[3];
+ GetColorLayerImageViewManager()->GetSpcOriginalLayer(0,spcOriginalLayer);
+ GetColorLayerImageViewManager()->GetDimensionOriginalLayer(0,dimensionOriginalLayer);
+ GetColorLayerImageViewManager()->GetSpcBase(0,spcBase);
+ GetColorLayerImageViewManager()->GetDimensionBase(0,dimensionBase);
+ GetColorLayerImageViewManager()->GetDimensionOriginalLayer(0,dimensionOriginalLayer);
+ if (_sl_SliceImageX!=NULL)
+ {
+ _sl_SliceImageX->SetRange( 0 , dimensionOriginalLayer[0] );
+ _sl_SliceImageY->SetRange( 0 , dimensionOriginalLayer[1] );
+ _sl_SliceImageZ->SetRange( 0 , dimensionOriginalLayer[2] );
+ }
+
+ int typeOfTransformation;
+ if (_fitting_mode == -1)
+ {
+ bool transformOkDlg;
+ wxString msg = _T("The image resolution of both images are not compatible. How do you want to tranform it? ");
+ wxDlgTransformByDimensionBySpacingByPixel dlg;
+ dlg.GetTransformType(this , spcBase , spcOriginalLayer , dimensionBase ,dimensionOriginalLayer ,msg,typeOfTransformation,transformOkDlg);
+ // CM Reset the default value (Pixel i.e. 3) if the dialog box returned an inappropriate value.
+ if (transformOkDlg == false)
+ {
+ typeOfTransformation = 3;
+ }
+ } else {
+ typeOfTransformation = _fitting_mode;
+ } // _fitting_mode -1
+
+ _colorLayerImageViewManager->SetFittingMode( typeOfTransformation );
+ _colorLayerImageViewManager->SetImageStep2( img );
+
+// } // img
+
}
+//----------------------------------------------------------------------------
void ColorLayerImageViewPanel::RefreshView()
{
//EED01 _colorLayerImageView->Refresh();
// w.ShowModal();
printf("EED ColorLayerImageViewPanel::onReadImage ....WARNING... Read dlg. all images creaImageIO ... ???\n");
- int ext[6];
- double spc[6];
- double origin[3];
+ int ext[6];
+ double spc[6];
+ double origin[3];
origin[0] = 0;
origin[1] = 0;
origin[2] = 0;
change -> Modified(); //important
change -> Update(); //important
SetImage( change->GetOutput() );
- _colorLayerImageViewManager->onThreshold();
+ GetColorLayerImageViewManager()->onThreshold();
RefreshView();
}
{
if (_thresholdGo)
{
- _colorLayerImageViewManager->onThresholdChange();
+ GetColorLayerImageViewManager()->onThresholdChange();
RefreshView();
//std::cout<< "Valor Min: " << minVal << " & Valor Max: " << maxVal << std::endl;
} // _thresholdGo
_active = _thresholdGo;
if (_thresholdGo)
{
- _colorLayerImageViewManager->onThreshold();
+ GetColorLayerImageViewManager()->onThreshold();
}else{
- _colorLayerImageViewManager->onThresholdRemove( );
+ GetColorLayerImageViewManager()->onThresholdRemove( );
}
RefreshView();
}
//----------------------------------------------------------------------------
void ColorLayerImageViewPanel::onThresholdStop()
{
- if (_thresholdGo)
- {
- _colorLayerImageViewManager->onThresholdRemove( );
- _thresholdGo=false;
- }
+ if (_thresholdGo)
+ {
+ GetColorLayerImageViewManager()->onThresholdRemove( );
+ _thresholdGo = false;
+ }
}
//----------------------------------------------------------------------------
void ColorLayerImageViewPanel::onThresholdInterpolation(wxCommandEvent& event)
{
- _colorLayerImageViewManager->onThresholdInterpolation(_interpolationCheckBox->GetValue());
- RefreshView();
+ GetColorLayerImageViewManager()->onThresholdInterpolation(_interpolationCheckBox->GetValue());
+ RefreshView();
}
//----------------------------------------------------------------------------
_colorLayerImageViewManager->SetSliceFixDynamic( fixdin );
if (fixdin==false)
{
- _colorLayerImageViewManager->SetX2( _sl_SliceImageX->GetValue() );
- _colorLayerImageViewManager->SetY2( _sl_SliceImageY->GetValue() );
- _colorLayerImageViewManager->SetZ2( _sl_SliceImageZ->GetValue() );
+ GetColorLayerImageViewManager()->SetX2( _sl_SliceImageX->GetValue() );
+ GetColorLayerImageViewManager()->SetY2( _sl_SliceImageY->GetValue() );
+ GetColorLayerImageViewManager()->SetZ2( _sl_SliceImageZ->GetValue() );
}
_sl_SliceImageX->Enable(!fixdin);
_sl_SliceImageY->Enable(!fixdin);
//----------------------------------------------------------------------------
void ColorLayerImageViewPanel::onSliceImage(wxScrollEvent& event)
{
- _colorLayerImageViewManager->SetX2( _sl_SliceImageX->GetValue() );
- _colorLayerImageViewManager->SetY2( _sl_SliceImageY->GetValue() );
- _colorLayerImageViewManager->SetZ2( _sl_SliceImageZ->GetValue() );
- _colorLayerImageViewManager->onThreshold();
+ GetColorLayerImageViewManager()->SetX2( _sl_SliceImageX->GetValue() );
+ GetColorLayerImageViewManager()->SetY2( _sl_SliceImageY->GetValue() );
+ GetColorLayerImageViewManager()->SetZ2( _sl_SliceImageZ->GetValue() );
+ GetColorLayerImageViewManager()->onThreshold();
RefreshView();
}
void ColorLayerImageViewPanel::ChangeOpacity()
{
int opacity = _opacity->GetValue();
- _colorLayerImageViewManager->onThresholdChangeOpacity(opacity);
+ GetColorLayerImageViewManager()->onThresholdChangeOpacity(opacity);
RefreshView();
}
{
_cb_ShowHide->SetValue( _active );
}
+ GetColorLayerImageViewManager()->SetActive( _active );
}