# ----------------------------------
-# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
-# - /home/davila/Creatis/C11/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/SliceImage-3DVisu.bbg
+# - BBTKGEditor v 1.5 BBG BlackBox Diagram file
+# - /Users/davila/Creatis/C11/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/SliceImage-3DVisu.bbg
# ----------------------------------
APP_START
COMPLEXOUTPUTS:1
COMPLEX_PORT
BoxChangeImageSlice
--180.302777:-317.574649:-900.000000
+-126.211944:-95.272395:-900.000000
FIN_COMPLEX_PORT
COMPLEXINPUTS:11
COMPLEX_PORT
Direction
--431.136158:282.815347:-900.000000
+-301.795311:84.844604:-900.000000
FIN_COMPLEX_PORT
COMPLEX_PORT
WindowColorLevel
--363.292621:285.496367:-900.000000
+-254.304835:85.648910:-900.000000
FIN_COMPLEX_PORT
COMPLEX_PORT
ColorBorder
--299.200657:287.687412:-900.000000
+-209.440460:86.306224:-900.000000
FIN_COMPLEX_PORT
COMPLEX_PORT
Image
--246.466668:285.529399:-900.000000
+-172.526668:85.658820:-900.000000
FIN_COMPLEX_PORT
COMPLEX_PORT
SliceDeep
--173.833881:283.175203:-900.000000
+-121.683717:84.952561:-900.000000
FIN_COMPLEX_PORT
COMPLEX_PORT
SliceOpacity
--137.466212:283.557306:-900.000000
+-96.226348:85.067192:-900.000000
FIN_COMPLEX_PORT
COMPLEX_PORT
Render
--100.149261:284.086627:-900.000000
+-70.104483:85.225988:-900.000000
FIN_COMPLEX_PORT
COMPLEX_PORT
BorderActive
--660.228760:278.316839:-900.000000
+-462.160132:83.495052:-900.000000
FIN_COMPLEX_PORT
COMPLEX_PORT
Interpolation_mode
-37.224821:284.244621:-900.000000
+26.057375:85.273386:-900.000000
FIN_COMPLEX_PORT
COMPLEX_PORT
TypeTransparence
--493.056508:283.285820:-900.000000
+-345.139556:84.985746:-900.000000
FIN_COMPLEX_PORT
COMPLEX_PORT
transparenceBeforeAboveRange
--552.809749:283.731184:-900.000000
+-386.966824:85.119355:-900.000000
FIN_COMPLEX_PORT
-BOXES:45
+BOXES:47
BOX
creaMaracasVisu:SliceImage:Box00
ISEXEC:FALSE
--195.575128:-74.642011:-900.000000
--158.350128:-84.642011:-900.000000
+-136.902590:-22.392603:-900.000000
+-115.177590:-24.892603:-900.000000
PORT
TypeOrientation:"1"
FIN_BOX
BOX
creaMaracasVisu:ImageActor:Box04
ISEXEC:FALSE
--175.861342:-256.750145:-900.000000
--137.911342:-266.750145:-900.000000
+-123.102939:-77.025043:-900.000000
+-101.307939:-79.525043:-900.000000
FIN_BOX
BOX
vtk:Transform:Box17
ISEXEC:FALSE
--320.706867:-77.874112:-900.000000
--285.131867:-87.874112:-900.000000
+-224.494807:-23.362234:-900.000000
+-202.939807:-25.862234:-900.000000
FIN_BOX
BOX
std:ConcatStrings:Box18
ISEXEC:FALSE
--272.546519:-70.682423:-900.000000
--232.821519:-80.682423:-900.000000
+-190.782563:-21.204727:-900.000000
+-168.022563:-23.704727:-900.000000
PORT
In1:"0 "
PORT
BOX
vtk:ImageVtkProperties:Box20
ISEXEC:FALSE
--312.672504:29.786119:-900.000000
--267.322504:19.786119:-900.000000
+-218.870753:8.935836:-900.000000
+-196.335753:6.435836:-900.000000
FIN_BOX
BOX
creaVtk:ScalarsToColors:Box22
ISEXEC:FALSE
--266.449667:-213.711970:-900.000000
--224.924667:-223.711970:-900.000000
+-186.514767:-64.113591:-900.000000
+-164.354767:-66.613591:-900.000000
PORT
Type:"101"
FIN_BOX
BOX
vtk:Transform:Box32
ISEXEC:FALSE
--321.807500:-96.018762:-900.000000
--286.232500:-106.018762:-900.000000
+-225.265250:-28.805629:-900.000000
+-203.710250:-31.305629:-900.000000
FIN_BOX
BOX
creaMaracasVisu:DrawAxisTree3D:Box26
ISEXEC:FALSE
--516.159924:-217.577049:-900.000000
--467.839924:-227.577049:-900.000000
+-358.893043:-63.660512:-900.000000
+-330.853043:-66.160512:-900.000000
PORT
Colour:"0 0 0"
PORT
lstPointZ:"0 0 0 0 0"
FIN_BOX
BOX
-vtk:Transform:Box27
-ISEXEC:FALSE
--316.662998:-136.217224:-900.000000
--281.087998:-146.217224:-900.000000
-FIN_BOX
-BOX
std:CreateArithmeticSuiteVector:Box33
ISEXEC:FALSE
--531.652610:-47.521093:-900.000000
--477.677610:-57.521093:-900.000000
+-372.156827:-14.256328:-900.000000
+-348.736827:-16.756328:-900.000000
PORT
Delta:"0"
PORT
BOX
std:GetVectorDoubleElement:Box34
ISEXEC:FALSE
--528.461121:-23.430170:-900.000000
--477.411121:-33.430170:-900.000000
+-369.922785:-7.029051:-900.000000
+-346.797785:-9.529051:-900.000000
PORT
I:"0"
FIN_BOX
BOX
std:MathOperationVector:Box35
ISEXEC:FALSE
--532.115714:-65.685386:-900.000000
--484.590714:-75.685386:-900.000000
+-372.481000:-19.705616:-900.000000
+-347.961000:-22.205616:-900.000000
PORT
In1:"0 1 1 0 0 "
PORT
BOX
std:CreateArithmeticSuiteVector:Box36
ISEXEC:FALSE
--461.446157:-46.434918:-900.000000
--407.471157:-56.434918:-900.000000
+-323.012310:-13.930475:-900.000000
+-299.592310:-16.430475:-900.000000
PORT
Delta:"0"
PORT
BOX
std:MathOperationVector:Box37
ISEXEC:FALSE
--462.838158:-67.517853:-900.000000
--415.313158:-77.517853:-900.000000
+-323.986711:-20.255356:-900.000000
+-299.466711:-22.755356:-900.000000
PORT
In1:"0 0 1 1 0 "
PORT
BOX
vtk:vtkImageDataPointerRelay:Box38
ISEXEC:FALSE
--242.147618:127.630990:-900.000000
--189.972618:117.630990:-900.000000
+-169.503333:38.289297:-900.000000
+-146.293333:35.789297:-900.000000
FIN_BOX
BOX
std:ConcatStrings:Box40
ISEXEC:FALSE
--451.527135:125.243442:-900.000000
--411.802135:115.243442:-900.000000
+-316.068994:37.573033:-900.000000
+-293.308994:35.073033:-900.000000
PORT
In1:"0"
FIN_BOX
BOX
std:StringSelect:Box41
ISEXEC:FALSE
--369.319073:-76.024573:-900.000000
--327.159073:-86.024573:-900.000000
+-257.303821:-17.929250:-900.000000
+-232.783821:-20.429250:-900.000000
PORT
In0:"0 1 0 0"
PORT
BOX
std:GetVectorDoubleElement:Box44
ISEXEC:FALSE
--459.560548:-23.370210:-900.000000
--408.510548:-33.370210:-900.000000
+-321.692384:-7.011063:-900.000000
+-298.567384:-9.511063:-900.000000
PORT
I:"1"
FIN_BOX
BOX
std:StringSelect:Box45
ISEXEC:FALSE
--589.306604:57.564106:-900.000000
--547.146604:47.564106:-900.000000
+-412.514623:17.269232:-900.000000
+-387.994623:14.769232:-900.000000
PORT
In0:"0"
PORT
BOX
std:StringSelect:Box46
ISEXEC:FALSE
--544.486050:58.335903:-900.000000
--502.326050:48.335903:-900.000000
+-381.140235:17.500771:-900.000000
+-356.620235:15.000771:-900.000000
PORT
In0:"1"
PORT
BOX
vtk:Transform:Box52
ISEXEC:FALSE
--312.196510:-56.034435:-900.000000
--276.621510:-66.034435:-900.000000
+-220.244900:-17.542049:-900.000000
+-198.689900:-20.042049:-900.000000
FIN_BOX
BOX
std:StringSelect:Box55
ISEXEC:FALSE
--373.718706:28.297047:-900.000000
--331.558706:18.297047:-900.000000
+-263.798249:14.342860:-900.000000
+-239.278249:11.842860:-900.000000
PORT
In0:"1"
PORT
BOX
std:ConcatStrings:Box57
ISEXEC:FALSE
--364.668989:127.201835:-900.000000
--324.943989:117.201835:-900.000000
+-255.268292:38.160550:-900.000000
+-232.508292:35.660550:-900.000000
PORT
In2:" "
FIN_BOX
BOX
std:ConcatStrings:Box60
ISEXEC:FALSE
--192.633834:15.326494:-900.000000
--152.908834:5.326494:-900.000000
+-132.827931:45.316156:-900.000000
+-110.067931:42.816156:-900.000000
PORT
BoxProcessMode:"Reactive"
FIN_BOX
BOX
std:MagicBox:Box61
ISEXEC:FALSE
--104.070259:168.890570:-900.000000
--67.995259:158.890570:-900.000000
+-72.849181:50.667171:-900.000000
+-51.249181:48.167171:-900.000000
FIN_BOX
BOX
std:ConcatStrings:Box62
ISEXEC:FALSE
--297.110093:125.771424:-900.000000
--257.385093:115.771424:-900.000000
+-207.977065:37.731427:-900.000000
+-185.217065:35.231427:-900.000000
PORT
In1:"1 1 0"
FIN_BOX
BOX
std:GetVectorDoubleElement:Box64
ISEXEC:FALSE
--387.763181:205.752953:-900.000000
--336.713181:195.752953:-900.000000
+-271.434227:61.725886:-900.000000
+-248.309227:59.225886:-900.000000
PORT
I:"0"
FIN_BOX
BOX
std:ConcatStrings:Box65
ISEXEC:FALSE
--366.909956:245.293365:-900.000000
--327.184956:235.293365:-900.000000
+-256.836969:73.588009:-900.000000
+-234.076969:71.088009:-900.000000
FIN_BOX
BOX
std:Div:Box66
ISEXEC:FALSE
--395.212975:191.256056:-900.000000
--365.887975:181.256056:-900.000000
+-276.649082:57.376817:-900.000000
+-255.724082:54.876817:-900.000000
PORT
In2:"2"
FIN_BOX
BOX
std:Add:Box67
ISEXEC:FALSE
--389.417275:153.273064:-900.000000
--358.967275:143.273064:-900.000000
+-272.592092:45.981919:-900.000000
+-251.557092:43.481919:-900.000000
FIN_BOX
BOX
std:GetVectorDoubleElement:Box68
ISEXEC:FALSE
--350.648788:191.725514:-900.000000
--299.598788:181.725514:-900.000000
+-245.454152:57.517654:-900.000000
+-222.329152:55.017654:-900.000000
PORT
I:"1"
FIN_BOX
BOX
std:Mul:Box69
ISEXEC:FALSE
--406.100940:175.438942:-900.000000
--376.300940:165.438942:-900.000000
+-284.270658:52.631683:-900.000000
+-263.295658:50.131683:-900.000000
PORT
In2:"-1"
FIN_BOX
BOX
std:Add:Box70
ISEXEC:FALSE
--345.592205:152.557386:-900.000000
--315.142205:142.557386:-900.000000
+-241.914543:45.767216:-900.000000
+-220.879543:43.267216:-900.000000
FIN_BOX
BOX
std:MathOperation:Box72
ISEXEC:FALSE
--257.408453:-30.946538:-900.000000
--216.358453:-40.946538:-900.000000
+-180.185917:-9.283961:-900.000000
+-158.085917:-11.783961:-900.000000
PORT
In1:"1"
PORT
BOX
std:MathOperation:Box73
ISEXEC:FALSE
--263.661305:-53.857110:-900.000000
--222.611305:-63.857110:-900.000000
+-186.514162:-15.913227:-900.000000
+-164.414162:-18.413227:-900.000000
PORT
Type:"2"
FIN_BOX
BOX
std:StringSelect:Box74
ISEXEC:FALSE
--336.062237:53.397805:-900.000000
--293.902237:43.397805:-900.000000
+-235.243566:16.019341:-900.000000
+-210.723566:13.519341:-900.000000
PORT
In0:"2"
PORT
BOX
std:GetVectorDoubleElement:Box75
ISEXEC:FALSE
--261.893099:1.211259:-900.000000
--210.843099:-8.788741:-900.000000
+-183.325169:0.363378:-900.000000
+-160.200169:-2.136622:-900.000000
FIN_BOX
BOX
vtk:Transform:Box79
ISEXEC:FALSE
--313.408336:-36.360191:-900.000000
--277.833336:-46.360191:-900.000000
+-217.190680:-10.908057:-900.000000
+-195.635680:-13.408057:-900.000000
PORT
Scale:"1 1 1"
FIN_BOX
BOX
creaMaracasVisu:ImageChangeInformation:Box80
ISEXEC:FALSE
--90.830876:-128.464526:-900.000000
--39.305876:-138.464526:-900.000000
+-139.575496:-39.950385:-900.000000
+-116.425496:-42.450385:-900.000000
PORT
NewSpacing:"1 1 1"
FIN_BOX
BOX
std:StringSelect:Box81
ISEXEC:FALSE
--474.548561:74.412243:-900.000000
--432.388561:64.412243:-900.000000
+-332.183993:22.323673:-900.000000
+-307.663993:19.823673:-900.000000
PORT
In0:"0"
PORT
BOX
std:MathOperationVector:Box82
ISEXEC:FALSE
--450.471349:8.131320:-900.000000
--402.946349:-1.868680:-900.000000
+-315.329944:2.439396:-900.000000
+-290.809944:-0.060604:-900.000000
PORT
In1:"-1 -1 -1"
PORT
BOX
std:MagicBox:Box83
ISEXEC:FALSE
--672.007424:211.414023:-900.000000
--635.932424:201.414023:-900.000000
+-470.405197:63.424207:-900.000000
+-448.805197:60.924207:-900.000000
FIN_BOX
BOX
std:MagicBox:Box78
ISEXEC:FALSE
-26.038479:172.632362:-900.000000
-62.113479:162.632362:-900.000000
+18.226935:51.789709:-900.000000
+39.826935:49.289709:-900.000000
FIN_BOX
BOX
std:MagicBox:Box84
ISEXEC:FALSE
--501.738590:206.404618:-900.000000
--465.663590:196.404618:-900.000000
+-354.643793:60.510358:-900.000000
+-333.043793:58.010358:-900.000000
FIN_BOX
BOX
std:MagicBox:Box85
ISEXEC:FALSE
--570.159315:210.007455:-900.000000
--534.084315:200.007455:-900.000000
+-399.917822:63.405387:-900.000000
+-378.317822:60.905387:-900.000000
FIN_BOX
-CONNECTIONS:71
+BOX
+wx:OutputText:Box86
+ISEXEC:FALSE
+-376.663958:-73.947331:-900.000000
+-354.993958:-76.447331:-900.000000
+FIN_BOX
+BOX
+wx:OutputText:Box87
+ISEXEC:FALSE
+-366.143615:-82.032981:-900.000000
+-344.473615:-84.532981:-900.000000
+FIN_BOX
+BOX
+wx:LayoutLine:Box88
+ISEXEC:FALSE
+-375.478516:-89.335399:-900.000000
+-342.158516:-91.835399:-900.000000
+FIN_BOX
+CONNECTIONS:74
CONNECTION
Box22:LookupTable:Box04:LookupTable
NumberOfControlPoints:0
Box26:BoxChange:Box04:BoxExecute
NumberOfControlPoints:0
CONNECTION
-Box32:Out:Box27:In
-NumberOfControlPoints:0
-CONNECTION
-Box27:Out:Box26:Transform
-NumberOfControlPoints:0
-CONNECTION
Box34:Out:Box33:FirstValue
NumberOfControlPoints:0
CONNECTION
CONNECTION
transparenceBeforeAboveRange:transparenceBeforeAboveRange:Box85:In
NumberOfControlPoints:0
+CONNECTION
+Box35:Out:Box86:In
+NumberOfControlPoints:0
+CONNECTION
+Box37:Out:Box87:In
+NumberOfControlPoints:0
+CONNECTION
+Box86:Widget:Box88:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box87:Widget:Box88:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box32:Out:Box26:Transform
+NumberOfControlPoints:0
APP_END
# ----------------------------------
-# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box)
-# - /home/davila/Creatis/C11/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/SliceImage-3DVisu.bbs
+# - BBTKGEditor v 1.5 BBS BlackBox Script (Complex Box)
+# - /Users/davila/Creatis/C11/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/SliceImage-3DVisu.bbs
# ----------------------------------
include std
include vtk
include std
include creaVtk
+include wx
define SliceImage-3DVisu creaMaracasVisu
set Box26.lstPointY "0 0 50 50 0"
set Box26.lstPointZ "0 0 0 0 0"
-new vtk:Transform Box27
-
new std:CreateArithmeticSuiteVector Box33
set Box33.Delta "0"
set Box33.Size "5"
new std:MagicBox Box85
+new wx:OutputText Box86
+
+new wx:OutputText Box87
+
+new wx:LayoutLine Box88
+
connect Box22.LookupTable Box04.LookupTable
connect Box32.Out Box04.Transform
connect Box26.BoxChange Box04.BoxExecute
-connect Box32.Out Box27.In
-connect Box27.Out Box26.Transform
connect Box34.Out Box33.FirstValue
connect Box33.ArithmeticSuiteVector Box35.In0
connect Box35.Out Box26.lstPointX
connect Box78.Out Box04.InterpolationMode
connect Box84.Out Box22.Type
connect Box85.Out Box22.BelowAboveRangeTransparence
+connect Box35.Out Box86.In
+connect Box37.Out Box87.In
+connect Box86.Widget Box88.Widget1
+connect Box87.Widget Box88.Widget2
+connect Box32.Out Box26.Transform
# Complex input ports
input Direction Box40.In1 " "
lstInconsistentContourID.clear();
// First Step Spline Interpolation
- std::vector<double> lstInX=bbGetInputLstControlPointsX();
- std::vector<double> lstInY=bbGetInputLstControlPointsY();
- std::vector<double> lstInZ=bbGetInputLstControlPointsZ();
+ std::vector<double> lstInX = bbGetInputLstControlPointsX();
+ std::vector<double> lstInY = bbGetInputLstControlPointsY();
+ std::vector<double> lstInZ = bbGetInputLstControlPointsZ();
if ( (lstInX.size()!=lstInY.size()) || (lstInY.size()!=lstInZ.size()) )
{
printf("Warnning !! .. ManualContourModel_Box: The list X Y Z, no have the same number of elements \n");
return;
}
- std::vector<int> lstIndexsIn=bbGetInputLstIndexsIn();
+ std::vector<int> lstIndexsIn = bbGetInputLstIndexsIn();
std::vector<int> lstIndexsOut;
std::vector<double> lstOutX;
std::vector<double> lstOutY;
lstIndexsIn.push_back( lstInX.size() );
}
+ // Step 0. Clean lstIndexIn
+ int i,size = lstIndexsIn.size();
+ for (i=size-1 ; i>=0; i--)
+ {
+ if (lstIndexsIn[i]==0)
+ {
+ lstIndexsIn.erase( lstIndexsIn.begin()+i );
+ } // if
+ } // for i
+
// Step 1. All contours the same clockwise direction (Control Points)
if (bbGetInputDoubleContour()==1)
{
ClockwisePoints( &lstInX , &lstInY , &lstInZ , &lstIndexsIn );
// ShiftValues( &lstInX , &lstInY , &lstInZ , &lstIndexsIn );
} // DoubleContour
- int i,size = lstIndexsIn.size();
+ size = lstIndexsIn.size();
int iGeneral= 0;
// Step 2. Spline interpolation of control points
// Step 3.1 Linear Normalice points around contours
RedistributionPoints(&lstOutX,&lstOutY,&lstOutZ,&lstIndexsOut);
//EED 01/2021
- // Step 3.2 Shift points to find minimun acumulate distance
- ShiftValues( &lstOutX, &lstOutY, &lstOutZ, &lstIndexsOut );
+ // Step 3.2 Shift points to find minimun acumulate distance
+ if (bbGetInputOpenClose()==true)
+ {
+ ShiftValues( &lstOutX, &lstOutY, &lstOutZ, &lstIndexsOut );
+ } // if OpenClose
// Step 3.3. SIN Normalice points around contours
- if (bbGetInputParam().size()>=1)
+ if (bbGetInputParam().size()==2)
{
- if (bbGetInputParam()[0]==1)
+ if (bbGetInputParam()[0]==1) // type param 1
{
- RedistributionPointsAllContours_SIN( &lstOutX,&lstOutY,&lstOutZ,&lstIndexsOut);
- ShiftValues( &lstOutX, &lstOutY, &lstOutZ, &lstIndexsOut );
- } // if 1
+ if (bbGetInputOpenClose()==true)
+ {
+ RedistributionPointsAllContours_SIN( &lstOutX,&lstOutY,&lstOutZ,&lstIndexsOut);
+ ShiftValues( &lstOutX, &lstOutY, &lstOutZ, &lstIndexsOut );
+ } // if OpenClose
+ } // if type param = 1
} // if size
// Step 3.4 Transpose the vectors
lstInX.clear();
BBTK_INPUT(ManualContourModel_Box,LstControlPointsX,"List of control points",std::vector<double>,"");
BBTK_INPUT(ManualContourModel_Box,LstControlPointsY,"List of control points",std::vector<double>,"");
BBTK_INPUT(ManualContourModel_Box,LstControlPointsZ,"List of control points",std::vector<double>,"");
- BBTK_INPUT(ManualContourModel_Box,Param,"Param",std::vector<double>,"");
+ BBTK_INPUT(ManualContourModel_Box,Param,"(default 0) 0:Nothing 1:If OpenClose=true RedistributionPointsAllContours_SIN 2:Nothing ",std::vector<double>,"");
BBTK_OUTPUT(ManualContourModel_Box,LstContourPointsX,"List of points in the contour",std::vector<double>,"");
BBTK_OUTPUT(ManualContourModel_Box,LstContourPointsY,"List of points in the contour",std::vector<double>,"");
BBTK_OUTPUT(ManualContourModel_Box,LstContourPointsZ,"List of points in the contour",std::vector<double>,"");
// txtNrPoints->SetLabel( strTmp );
//--BBTK
- mbbShowNPoints->bbSetOutputlstPointsX( GetModelShowNPoints()->GetLstPointsX() );
- mbbShowNPoints->bbSetOutputlstPointsY( GetModelShowNPoints()->GetLstPointsY() );
- mbbShowNPoints->bbSetOutputlstPointsZ( GetModelShowNPoints()->GetLstPointsZ() );
- mbbShowNPoints->bbSetOutputlstLabels( GetModelShowNPoints()->GetLstLabels() );
+ mbbShowNPoints->bbSetOutputlstPointsX( GetLstPointsX() );
+ mbbShowNPoints->bbSetOutputlstPointsY( GetLstPointsY() );
+ mbbShowNPoints->bbSetOutputlstPointsZ( GetLstPointsZ() );
+ mbbShowNPoints->bbSetOutputlstLabels( GetLstLabels() );
+ mbbShowNPoints->bbSetOutputlstIndexs( GetLstIndexs() );
+ // mbbShowNPoints->bbSetOutputlstPointsX( GetModelShowNPoints()->GetLstPointsX() );
+ // mbbShowNPoints->bbSetOutputlstPointsY( GetModelShowNPoints()->GetLstPointsY() );
+ // mbbShowNPoints->bbSetOutputlstPointsZ( GetModelShowNPoints()->GetLstPointsZ() );
+ // mbbShowNPoints->bbSetOutputlstLabels( GetModelShowNPoints()->GetLstLabels() );
mbbShowNPoints->bbSignalOutputModification();
}
{
if (mwxwidget!=NULL)
{
+ printf("EED ShowNPoints::Process point: %d %d %d\n", bbGetInputIn()[0], bbGetInputIn()[1], bbGetInputIn()[2] );
mwxwidget->SetRenderer( bbGetInputRenderer() );
mwxwidget->SetReferencePoint( bbGetInputIn() );
mwxwidget->SetImage( bbGetInputImage() );
mwxwidget->GetModelShowNPoints()->SetFirstTime(false);
mwxwidget->SetInitLstPoints( bbGetInputInitLstPointsX() , bbGetInputInitLstPointsY() , bbGetInputInitLstPointsZ() , bbGetInputInitLstLabels() );
}
- bbSetOutputlstPointsX( mwxwidget->GetModelShowNPoints()->GetLstPointsX() );
- bbSetOutputlstPointsY( mwxwidget->GetModelShowNPoints()->GetLstPointsY() );
- bbSetOutputlstPointsZ( mwxwidget->GetModelShowNPoints()->GetLstPointsZ() );
- bbSetOutputlstLabels( mwxwidget->GetModelShowNPoints()->GetLstLabels() );
- bbSetOutputWidgetShowNPoints( (WidgetShowNPoints*)mwxwidget );
+ bbSetOutputlstPointsX( mwxwidget->GetLstPointsX() );
+ bbSetOutputlstPointsY( mwxwidget->GetLstPointsY() );
+ bbSetOutputlstPointsZ( mwxwidget->GetLstPointsZ() );
+ bbSetOutputlstLabels( mwxwidget->GetLstLabels() );
+ bbSetOutputlstIndexs( mwxwidget->GetLstIndexs() );
+
+// bbSetOutputlstPointsX( mwxwidget->GetModelShowNPoints()->GetLstPointsX() );
+// bbSetOutputlstPointsY( mwxwidget->GetModelShowNPoints()->GetLstPointsY() );
+// bbSetOutputlstPointsZ( mwxwidget->GetModelShowNPoints()->GetLstPointsZ() );
+ // bbSetOutputlstLabels( mwxwidget->GetModelShowNPoints()->GetLstLabels() );
+ bbSetOutputWidgetShowNPoints( (WidgetShowNPoints*)mwxwidget );
} // mwxwidget
}
bbSetOutputWidgetShowNPoints(NULL);
}
-//-----------------------------------------------------------------
+//------------------ -----------------------------------------------
void ShowNPoints::bbUserInitializeProcessing()
{
}
BBTK_DECLARE_INPUT(Colour, std::vector<double> );
BBTK_DECLARE_INPUT(Opacity, double );
BBTK_DECLARE_INPUT(Radio, double );
- BBTK_DECLARE_INPUT(InitLstPointsX, std::vector<int> );
- BBTK_DECLARE_INPUT(InitLstPointsY, std::vector<int> );
- BBTK_DECLARE_INPUT(InitLstPointsZ, std::vector<int> );
- BBTK_DECLARE_INPUT(InitLstLabels, std::vector<std::string> );
+ BBTK_DECLARE_INPUT(InitLstPointsX , std::vector<int> );
+ BBTK_DECLARE_INPUT(InitLstPointsY , std::vector<int> );
+ BBTK_DECLARE_INPUT(InitLstPointsZ , std::vector<int> );
+ BBTK_DECLARE_INPUT(InitLstLabels , std::vector<std::string> );
+ BBTK_DECLARE_INPUT(InitLstIndexs , std::vector<int> );
BBTK_DECLARE_INPUT(Type, int );
- BBTK_DECLARE_OUTPUT( lstPointsX, std::vector<int> );
- BBTK_DECLARE_OUTPUT( lstPointsY, std::vector<int> );
- BBTK_DECLARE_OUTPUT( lstPointsZ, std::vector<int> );
- BBTK_DECLARE_OUTPUT( lstLabels, std::vector<std::string> );
+ BBTK_DECLARE_OUTPUT( lstPointsX , std::vector<int> );
+ BBTK_DECLARE_OUTPUT( lstPointsY , std::vector<int> );
+ BBTK_DECLARE_OUTPUT( lstPointsZ , std::vector<int> );
+ BBTK_DECLARE_OUTPUT( lstLabels , std::vector<std::string> );
BBTK_DECLARE_OUTPUT( WidgetShowNPoints, WidgetShowNPoints*);
+ BBTK_DECLARE_OUTPUT( lstIndexs , std::vector<int> );
BBTK_PROCESS(Process);
void Process();
BBTK_CREATE_WIDGET(CreateWidget);
BBTK_INPUT(ShowNPoints,InitLstPointsY,"Initial lst of points Y",std::vector<int>,"");
BBTK_INPUT(ShowNPoints,InitLstPointsZ,"Initial lst of points Z",std::vector<int>,"");
BBTK_INPUT(ShowNPoints,InitLstLabels,"Initial lst of labels",std::vector<std::string>,"");
+ BBTK_INPUT(ShowNPoints,InitLstIndexs,"Initial lst of indexs sizes",std::vector<int>,"");
BBTK_INPUT(ShowNPoints,Type,"Type of the widget. 0(default): N-points, 1:Just one point, 2:Add/DeleteAll points, 3:As 0 with out save/load option, 4 Multiple NPoints",int,"");
BBTK_OUTPUT(ShowNPoints , lstPointsX , " list of points X ", std::vector<int> ,"");
BBTK_OUTPUT(ShowNPoints , lstPointsY , " list of points Y ", std::vector<int> ,"");
BBTK_OUTPUT(ShowNPoints , lstPointsZ , " list of points Z ", std::vector<int> ,"");
BBTK_OUTPUT(ShowNPoints , lstLabels , " list of labels ", std::vector<std::string> ,"");
+ BBTK_OUTPUT(ShowNPoints , lstIndexs , " list of index sizes ", std::vector<int> ,"");
BBTK_OUTPUT(ShowNPoints , WidgetShowNPoints , " WidgetShowNPoints ", WidgetShowNPoints* ,"");
BBTK_END_DESCRIBE_BLACK_BOX(ShowNPoints);
int ModelShowNPoints::IdInsidePoint()
{
int id=-1;
- int i, size=(int)(lstPointsX.size());
- double spc[3];
+ int i, size=(int)( lstPointsX.size() );
+ double spc[3];
if(mimage ==NULL)
{
printf("WidgetShowNPoints::IdInsidePoint image not set\n");
void SavePoints_(FILE* ff);
int ReadPoints(std::string filename);
+ int ReadPoints_(FILE* ff);
int GetNearestPoint();
int GetLstPointsSize();
#include <wx/button.h>
+#include <wx/checkbox.h>
#include <wx/sizer.h>
#include <wx/filedlg.h>
#include <wx/msgdlg.h>
wxButton *btnSaveCollection = new wxButton( panel2, -1, _T("Save Groups"));
wxButton *btnLoadCollection = new wxButton( panel2, -1, _T("Load Groups"));
- //NTU: Sliders for opacity and radio change
- wxStaticText* txOpacity = new wxStaticText(panel2, -1, wxString(_T(" Points Opacity ")));
- sdrOpacity = new wxSlider(panel2, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
- wxStaticText* txRadio = new wxStaticText(panel2, -1, wxString(_T(" Points Radius ")));
- sdrRadio = new wxSlider(panel2, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
- //NTU: Slider events
- Connect(sdrOpacity->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
- Connect(sdrRadio->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
-
+ wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1);
+ wxFlexGridSizer *sizer2 = new wxFlexGridSizer(2);
+ wxStaticText* txOpacity = new wxStaticText(panel2, -1, wxString(_T(" Points Opacity ")));
+ sdrOpacity = new wxSlider(panel2, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
+ wxStaticText* txRadio = new wxStaticText(panel2, -1, wxString(_T(" Points Radius ")));
+ sdrRadio = new wxSlider(panel2, -1, 0, 1, 50, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
+
+ Connect(btnBackCollection->GetId() , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnBackCollection );
+ Connect(btnNextCollection->GetId() , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnNextCollection );
Connect(btnInsertCollectionBefore->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnInsertCollectionBefore );
Connect(btnInsertCollectionAfter->GetId() , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnInsertCollectionAfter );
Connect(btnDeleteCollection->GetId() , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnDeleteCollection );
- Connect(btnBackCollection->GetId() , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnBackCollection );
+ Connect(sdrOpacity->GetId() , wxEVT_COMMAND_SLIDER_UPDATED, (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints );
+ Connect(sdrRadio->GetId() , wxEVT_COMMAND_SLIDER_UPDATED, (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints );
Connect(btnSaveCollection->GetId() , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnSaveCollections );
Connect(btnLoadCollection->GetId() , wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnLoadCollections );
- wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1);
- wxFlexGridSizer *sizer2 = new wxFlexGridSizer(2);
sizer2->Add( btnBackCollection );
sizer2->Add( btnNextCollection );
// Widget interface
askPointLabel = new wxStaticText(panel, -1, _T("Point label :")); // JPR
textCtrl = new wxTextCtrl(panel, -1);
- wxButton *btnAddPoint = new wxButton( panel, -1, _T("Add Point"));
- wxButton *btnInsertPoint = new wxButton( panel, -1, _T("Insert Point"));//CFT
- wxButton *btnSetPositionPoint = new wxButton( panel, -1, _T("Set nearest point"));
- wxButton *btnRenamePoint = new wxButton( panel, -1, _T("Rename point"));
- wxButton *btnEraseLastPoint = new wxButton( panel, -1, _T("Erase Last point"));
- wxButton *btnErasePoint = new wxButton( panel, -1, _T("Erase point"));
- wxButton *btnDeleteAllPoints = new wxButton( panel, -1, _T("Delete all points"));
- wxButton *btnSavePoints = NULL;
- wxButton *btnLoadPoints = NULL;
+ wxButton *btnAddPoint = new wxButton( panel, -1, _T("Add Point"));
+ wxButton *btnInsertPoint = new wxButton( panel, -1, _T("Insert Point"));//CFT
+ wxButton *btnSetPositionPoint= new wxButton( panel, -1, _T("Set nearest point"));
+ wxCheckBox *chkBox = new wxCheckBox(panel, -1, _T("Track Point") );
+ wxButton *btnRenamePoint = new wxButton( panel, -1, _T("Rename point"));
+ wxButton *btnEraseLastPoint = new wxButton( panel, -1, _T("Erase Last point"));
+ wxButton *btnErasePoint = new wxButton( panel, -1, _T("Erase point"));
+ wxButton *btnDeleteAllPoints = new wxButton( panel, -1, _T("Delete all points"));
+ wxButton *btnSavePoints = NULL;
+ wxButton *btnLoadPoints = NULL;
if ( mtype==0 )
{
btnSavePoints = new wxButton( panel, -1, _T("Save points"));
sizer1->Add(textCtrl);
sizer1->Add(btnAddPoint);
sizer1->Add(btnInsertPoint);//CFT
+ sizer1->Add(chkBox);
sizer1->Add(btnSetPositionPoint);
sizer1->Add(btnRenamePoint);
sizer1->Add(btnErasePoint);
//NTU: Method for updating points opacity and Radio
//------------------------------------------------------------------------
-void WidgetShowNPoints::UpdatePoints(wxCommandEvent &event)
+void WidgetShowNPoints::UpdatePoints_()
{
// EED 2022-05-19
- //this->mopacity = sdrOpacity->GetValue()/100.0;
+ //this->mopacity = sdrOpacity->GetValue()/100.0;
//GetModelShowNPoints()->SetRadio( sdrRadio->GetValue() ) ;
//RefreshPoints();
lstModelShowNPoints[i]->SetRadio( radio ) ;
} // for i
// GetViewShowNPoints()->RefreshPoints();
+}
+
+//------------------------------------------------------------------------
+void WidgetShowNPoints::UpdatePoints(wxCommandEvent &event)
+{
RefreshColourCollection();
}
void WidgetShowNPoints::SetReferencePoint(std::vector<int> point)
{
GetModelShowNPoints()->SetReferencePoint(point);
+ int i,size=lstModelShowNPoints.size();
+ for (i=0;i<size;i++)
+ {
+ lstModelShowNPoints[i]->SetReferencePoint(point); // All collection
+ } // for i
}
//------------------------------------------------------------------------
}
//------------------------------------------------------------------------
-void WidgetShowNPoints::OnDeleteCollection(wxCommandEvent &event)
+void WidgetShowNPoints::DeleteCollection_()
{
if ( lstModelShowNPoints.size()>1 )
{
} else {
DeleteAllPoints(); // Actual Collection
} // if
+}
+//------------------------------------------------------------------------
+void WidgetShowNPoints::OnDeleteCollection(wxCommandEvent &event)
+{
+ DeleteCollection_();
RefreshCollectionText();
RefreshColourCollection();
}
//------------------------------------------------------------------------
void WidgetShowNPoints::RefreshColourCollection()
{
+ UpdatePoints_();
std::vector<double> colourAll;
colourAll.push_back(1);
colourAll.push_back(0);
colourActual.push_back(1);
colourActual.push_back(0);
SetColour( colourAll ); // For all collections
-
int i,size=lstViewShowNPoints.size();
for (i=0;i<size;i++)
{
wxFD_OPEN | wxFD_FILE_MUST_EXIST,
wxDefaultPosition);
#endif
- int i;
- //EED
+ bool okEraseFirstGrout=false;
+
int result_FD = FD->ShowModal();
// This line is need it by windows //EED
FD->SetReturnCode( result_FD );
if (FD->GetReturnCode()==wxID_OK)
{
-
+ if (lstModelShowNPoints.size()==1)
+ {
+ if (GetModelShowNPoints()->GetLstPointsSize()==0) { okEraseFirstGrout=true; }
+ }
+ std::string filename= (const char*) ( FD->GetPath().mb_str() );
FILE *ff = fopen( filename.c_str() , "r+" );
if (ff!=NULL)
{
+ int i;
int iGroup,sizeGroups;
- int iPoint,numberPointsRead
+ int iPoint,numberPointsRead;
char chartmp[256];
fscanf(ff," %s %d",chartmp,&sizeGroups);
-
- /// InsertCollection();
-
- for (iGroup=0;i<sizeGroups;i++)
+ for (iGroup=0;iGroup<sizeGroups;iGroup++)
{
- int numberPointsRead= lstModelShowNPoints?????????[i]->ReadPoints_(ff);
+ mActualCollection = lstModelShowNPoints.size();
+ InsertCollection();
+
+ int numberPointsRead= lstModelShowNPoints[mActualCollection]->ReadPoints_(ff);
for (i=0;i<numberPointsRead;i++)
{
// EED 2022-05-19
//AddVtkPoint();
- GetViewShowNPoints?????()->AddVtkPoint();
+ GetViewShowNPoints()->AddVtkPoint();
}// for
} // for i
} else { // else ff
printf("WidgetShowNPoints::Load Group of Points ...Error... reading file");
} //ff
-
+ if (okEraseFirstGrout==true)
+ {
+ mActualCollection=0;
+ DeleteCollection_();
+ mActualCollection = lstModelShowNPoints.size()-1;
+ }
RefreshCollectionText();
RefreshColourCollection();
-
} // dialog box
+}
-///
-
+
+//------------------------------------------------------------------------
+std::vector<int> WidgetShowNPoints::GetLstPointsX()
+{
+ if (mtype!=4)
+ {
+ return GetModelShowNPoints()->GetLstPointsX();
+ } else {
+ std::vector<int> lst;
+ int iP,s;
+ int iG,sG=lstModelShowNPoints.size();
+ for (iG=0 ; iG<sG ; iG++)
+ {
+ std::vector<int> lstTmp = lstModelShowNPoints[iG]->GetLstPointsX();
+ s = lstTmp.size();
+ for (iP=0 ; iP<s ; iP++)
+ {
+ lst.push_back( lstTmp[iP] );
+ } // for iP
+ } // for iG
+ return lst;
+ } // if 4
+}
+
+//------------------------------------------------------------------------
+std::vector<int> WidgetShowNPoints::GetLstPointsY()
+{
+ if (mtype!=4)
+ {
+ return GetModelShowNPoints()->GetLstPointsY();
+ } else {
+ std::vector<int> lst;
+ int iP,s;
+ int iG,sG=lstModelShowNPoints.size();
+ for (iG=0 ; iG<sG ; iG++)
+ {
+ std::vector<int> lstTmp = lstModelShowNPoints[iG]->GetLstPointsY();
+ s = lstTmp.size();
+ for (iP=0 ; iP<s ; iP++)
+ {
+ lst.push_back( lstTmp[iP] );
+ } // for iP
+ } // for iG
+ return lst;
+ }
+}
+
+//------------------------------------------------------------------------
+std::vector<int> WidgetShowNPoints::GetLstPointsZ()
+{
+ if (mtype!=4)
+ {
+ return GetModelShowNPoints()->GetLstPointsZ();
+ } else {
+ std::vector<int> lst;
+ int iP,s;
+ int iG,sG=lstModelShowNPoints.size();
+ for (iG=0 ; iG<sG ; iG++)
+ {
+ std::vector<int> lstTmp = lstModelShowNPoints[iG]->GetLstPointsZ();
+ s = lstTmp.size();
+ for (iP=0 ; iP<s ; iP++)
+ {
+ lst.push_back( lstTmp[iP] );
+ } // for iP
+ } // for iG
+ return lst;
+
+ }
+}
+
+//------------------------------------------------------------------------
+std::vector<std::string> WidgetShowNPoints::GetLstLabels()
+{
+ if (mtype!=4)
+ {
+ return GetModelShowNPoints()->GetLstLabels();
+ } else {
+ std::vector< std::string > lst;
+ int iP,s;
+ int iG,sG=lstModelShowNPoints.size();
+ for (iG=0 ; iG<sG ; iG++)
+ {
+ std::vector< std::string > lstTmp = lstModelShowNPoints[iG]->GetLstLabels();
+ s = lstTmp.size();
+ for (iP=0 ; iP<s ; iP++)
+ {
+ lst.push_back( lstTmp[iP] );
+ } // for iP
+ } // for iG
+ return lst;
+ }
}
+
+//------------------------------------------------------------------------
+std::vector<int> WidgetShowNPoints::GetLstIndexs()
+{
+ std::vector<int> lstIndexs;
+ if (mtype!=4)
+ {
+ lstIndexs.push_back( GetModelShowNPoints()->GetLstPointsSize() );
+ } else {
+ int iG,sG=lstModelShowNPoints.size();
+ for (iG=0 ; iG<sG ; iG++)
+ {
+ lstIndexs.push_back( lstModelShowNPoints[iG]->GetLstPointsSize() );
+ } // for iG
+ }
+ return lstIndexs;
+}
+
void OnLoadPoints(wxCommandEvent &event);
virtual void UpdatePoints(wxCommandEvent &event);
+ void UpdatePoints_();
void InsertCollection();
void OnInsertCollectionBefore(wxCommandEvent &event);
void OnInsertCollectionAfter(wxCommandEvent &event);
void OnDeleteCollection(wxCommandEvent &event);
+ void DeleteCollection_();
void OnBackCollection(wxCommandEvent &event);
void OnNextCollection(wxCommandEvent &event);
void OnSaveCollections(wxCommandEvent &event);
double GetRadio();
double GetOpacity();
+
+
+ std::vector<int> GetLstPointsX();
+ std::vector<int> GetLstPointsY();
+ std::vector<int> GetLstPointsZ();
+ std::vector<std::string> GetLstLabels();
+ std::vector<int> GetLstIndexs();
+
+
protected:
- virtual void SetOutputBox();
+ virtual void SetOutputBox();
private:
void ErasePoint(int id);