# ----------------------------------
# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
-# - /home/davila/Creatis/creaTools/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/Measure3DLength_Widget.bbg
+# - /tmpEED/creaTools/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/Measure3DLength_Widget.bbg
# ----------------------------------
APP_START
point
16.233479:122.637795:-900.000000
FIN_COMPLEX_PORT
-BOXES:13
+BOXES:14
BOX
vtk:vtkImageDataPointerRelay:Box17
ISEXEC:FALSE
BOX
wx:OutputText:Box34
ISEXEC:FALSE
--115.357081:-42.579068:-900.000000
--69.782081:-52.579068:-900.000000
+-120.431062:-30.355387:-900.000000
+-74.856062:-40.355387:-900.000000
+PORT
+Title:"Units"
FIN_BOX
BOX
wx:LayoutLine:Box35
-58.228353:0.397139:-900.000000
12.946647:-9.602861:-900.000000
FIN_BOX
-CONNECTIONS:28
+BOX
+wx:OutputText:Box13
+ISEXEC:FALSE
+-105.274407:-45.411981:-900.000000
+-59.699407:-55.411981:-900.000000
+PORT
+Title:"Voxels"
+FIN_BOX
+CONNECTIONS:31
CONNECTION
vtkimagedata:vtkimagedata:Box17:In
NumberOfControlPoints:0
CONNECTION
Box31:BoxChange:Box36:BoxExecute
NumberOfControlPoints:0
+CONNECTION
+Box42:LengthVoxels:Box13:In
+NumberOfControlPoints:0
+CONNECTION
+Box13:Widget:Box35:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box31:BoxChange:Box13:BoxExecute
+NumberOfControlPoints:0
APP_END
# ----------------------------------
# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box)
-# - /home/davila/Creatis/creaTools/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/Measure3DLength_Widget.bbs
+# - /tmpEED/creaTools/creatools_source/creaMaracasVisu/bbtk/bbs/boxes/Measure3DLength_Widget.bbs
# ----------------------------------
include std
category "example"
-new vtkImageDataPointerRelay Box17
+new vtk:vtkImageDataPointerRelay Box17
-new MagicBox Box24
+new std:MagicBox Box24
-new ShowNPoints Box31
+new creaMaracasVisu:ShowNPoints Box31
-new LayoutSplit Box32
+new wx:LayoutSplit Box32
set Box32.Proportion "10"
-new LayoutTab Box33
+new wx:LayoutTab Box33
-new OutputText Box34
+new wx:OutputText Box34
+ set Box34.Title "Units"
-new LayoutLine Box35
+new wx:LayoutLine Box35
-new DrawAxe3D Box36
+new creaMaracasVisu:DrawAxe3D Box36
-new ImageVtkProperties Box38
+new vtk:ImageVtkProperties Box38
-new Transform Box39
+new vtk:Transform Box39
-new UpdateRender Box41
+new vtk:UpdateRender Box41
set Box41.Active "true"
-new MeasureLength Box42
+new vtk:MeasureLength Box42
-new PointsXYZtoVTKPoints Box43
+new vtk:PointsXYZtoVTKPoints Box43
+
+new wx:OutputText Box13
+ set Box13.Title "Voxels"
connect Box17.Out Box31.Image
connect Box31.BoxChange Box34.BoxExecute
connect Box17.Out Box42.ImageData
connect Box31.BoxChange Box36.BoxExecute
+connect Box42.LengthVoxels Box13.In
+connect Box13.Widget Box35.Widget2
+connect Box31.BoxChange Box13.BoxExecute
# Complex input ports
input vtkimagedata Box17.In " "
# Complex output ports
output widget Box33.Widget " "
+message
endefine
COMPLEXINPUTS:3
COMPLEX_PORT
minIn
--93.366735:127.318274:-900.000000
+-73.142665:123.211222:-900.000000
FIN_COMPLEX_PORT
COMPLEX_PORT
maxIn
-59.415195:128.107845:-900.000000
+67.267728:127.270782:-900.000000
FIN_COMPLEX_PORT
COMPLEX_PORT
showactual
--20.726231:117.843426:-900.000000
+-1.476857:124.516542:-900.000000
FIN_COMPLEX_PORT
-BOXES:12
+BOXES:14
BOX
creaMaracasVisu:SliderMinMax:Box02
ISEXEC:FALSE
--13.746804:37.276148:-900.000000
-40.733196:27.276148:-900.000000
+-12.321577:26.349409:-900.000000
+42.158423:16.349409:-900.000000
+PORT
+InMax:"2000"
+PORT
+InMaxShow:"2000"
PORT
ShowActual:"false"
PORT
BOX
wx:InputText:Box05
ISEXEC:FALSE
--85.579149:90.776322:-900.000000
--40.004149:80.776322:-900.000000
+-86.792132:90.521284:-900.000000
+-41.217132:80.521284:-900.000000
PORT
In:"0"
PORT
BOX
wx:InputText:Box06
ISEXEC:FALSE
-30.105048:89.547704:-900.000000
-75.680048:79.547704:-900.000000
+31.125200:89.547704:-900.000000
+76.700200:79.547704:-900.000000
PORT
In:"2000"
PORT
23.319252:55.999804:-900.000000
FIN_BOX
BOX
-std:SharedMemory:Box08
-ISEXEC:FALSE
--85.227892:-39.232829:-900.000000
--39.652892:-49.232829:-900.000000
-FIN_BOX
-BOX
std:SharedMemory:Box10
ISEXEC:FALSE
-97.336689:-38.318654:-900.000000
-142.911689:-48.318654:-900.000000
+97.529520:-38.318654:-900.000000
+143.104520:-48.318654:-900.000000
+PORT
+In:"2000"
FIN_BOX
BOX
wx:LayoutTab:Box11
ISEXEC:FALSE
-13.169337:-39.363933:-900.000000
-70.729337:-49.363933:-900.000000
+21.747888:-40.059491:-900.000000
+79.307888:-50.059491:-900.000000
FIN_BOX
BOX
wx:LayoutLine:Box12
BOX
wx:InputText:Box13
ISEXEC:FALSE
-76.212141:29.821233:-900.000000
-121.787141:19.821233:-900.000000
+72.106029:31.364213:-900.000000
+117.681029:21.364213:-900.000000
PORT
In:"0.0"
PORT
BOX
std:MultipleInputs:Box15
ISEXEC:FALSE
--25.248762:-32.262307:-900.000000
-20.326238:-42.262307:-900.000000
+-29.653964:-38.754183:-900.000000
+15.921036:-48.754183:-900.000000
+FIN_BOX
+BOX
+std:MagicBox:Box16
+ISEXEC:FALSE
+-79.546253:108.370419:-900.000000
+-33.971253:98.370419:-900.000000
+FIN_BOX
+BOX
+std:MagicBox:Box17
+ISEXEC:FALSE
+43.097521:111.309388:-900.000000
+88.672521:101.309388:-900.000000
+FIN_BOX
+BOX
+std:SharedMemory:Box18
+ISEXEC:FALSE
+-106.391039:-33.391884:-900.000000
+-60.816039:-43.391884:-900.000000
FIN_BOX
-CONNECTIONS:29
+CONNECTIONS:35
CONNECTION
Box02:Widget:Box04:Widget2
NumberOfControlPoints:0
Box05:Out:Box02:InMin
NumberOfControlPoints:0
CONNECTION
-Box06:Out:Box02:InMax
-NumberOfControlPoints:0
-CONNECTION
Box09:BoxChange:Box02:BoxExecute
NumberOfControlPoints:0
CONNECTION
Box02:OutActual:outactual:outactual
NumberOfControlPoints:0
CONNECTION
-minIn:minIn:Box05:In
+showactual:showactual:Box02:ShowActual
NumberOfControlPoints:0
CONNECTION
-maxIn:maxIn:Box06:In
+Box02:OutEnd:Box10:In1
NumberOfControlPoints:0
CONNECTION
-showactual:showactual:Box02:ShowActual
+Box05:Out:Box02:InMinShow
NumberOfControlPoints:0
CONNECTION
-Box02:OutStart:Box08:In1
+Box10:Out:outend:outend
NumberOfControlPoints:0
CONNECTION
-Box02:OutEnd:Box10:In1
+Box04:Widget:Box11:Widget1
NumberOfControlPoints:0
CONNECTION
-Box05:Out:Box02:InMinShow
+Box11:Widget:widget:widget
NumberOfControlPoints:0
CONNECTION
-Box06:Out:Box02:InMaxShow
+Box13:Widget:Box12:Widget1
NumberOfControlPoints:0
CONNECTION
-Box10:Out:outend:outend
+Box14:Widget:Box12:Widget2
NumberOfControlPoints:0
CONNECTION
-Box08:Out:outstart:outstart
+Box12:Widget:Box11:Widget2
NumberOfControlPoints:0
CONNECTION
-Box04:Widget:Box11:Widget1
+Box13:BoxChange:Box15:In1
NumberOfControlPoints:0
CONNECTION
-Box11:Widget:widget:widget
+Box14:BoxChange:Box15:In2
NumberOfControlPoints:0
CONNECTION
-Box13:Widget:Box12:Widget1
+Box02:BoxChange:Box15:In3
NumberOfControlPoints:0
CONNECTION
-Box14:Widget:Box12:Widget2
+Box15:BoxChange:boxchange:boxchange
NumberOfControlPoints:0
CONNECTION
-Box12:Widget:Box11:Widget2
+Box06:Out:Box02:InMax
NumberOfControlPoints:0
CONNECTION
-Box13:Out:Box08:In
+Box06:Out:Box02:InMaxShow
NumberOfControlPoints:0
CONNECTION
-Box14:Out:Box10:In
+Box06:Out:Box10:In2
NumberOfControlPoints:0
CONNECTION
-Box13:BoxChange:Box15:In1
+Box14:Out:Box10:In3
NumberOfControlPoints:0
CONNECTION
-Box14:BoxChange:Box15:In2
+minIn:minIn:Box16:In
NumberOfControlPoints:0
CONNECTION
-Box02:BoxChange:Box15:In3
+Box16:Out:Box05:In
NumberOfControlPoints:0
CONNECTION
-Box15:BoxChange:boxchange:boxchange
+maxIn:maxIn:Box17:In
+NumberOfControlPoints:0
+CONNECTION
+Box17:Out:Box06:In
+NumberOfControlPoints:0
+CONNECTION
+Box17:Out:Box10:In
+NumberOfControlPoints:0
+CONNECTION
+Box18:Out:outstart:outstart
+NumberOfControlPoints:0
+CONNECTION
+Box16:Out:Box18:In
+NumberOfControlPoints:0
+CONNECTION
+Box02:OutStart:Box18:In1
+NumberOfControlPoints:0
+CONNECTION
+Box05:Out:Box18:In2
+NumberOfControlPoints:0
+CONNECTION
+Box13:Out:Box18:In3
NumberOfControlPoints:0
APP_END
category "<VOID>"
new creaMaracasVisu:SliderMinMax Box02
+ set Box02.InMax "2000"
+ set Box02.InMaxShow "2000"
set Box02.ShowActual "false"
set Box02.ShowLabels "1"
new std:MultipleInputs Box09
-new std:SharedMemory Box08
-
new std:SharedMemory Box10
+ set Box10.In "2000"
new wx:LayoutTab Box11
new std:MultipleInputs Box15
+new std:MagicBox Box16
+
+new std:MagicBox Box17
+
+new std:SharedMemory Box18
+
connect Box02.Widget Box04.Widget2
connect Box06.Widget Box04.Widget3
connect Box05.Widget Box04.Widget1
connect Box05.Out Box02.InMin
-connect Box06.Out Box02.InMax
connect Box09.BoxChange Box02.BoxExecute
connect Box06.BoxChange Box09.In2
connect Box05.BoxChange Box09.In1
-connect Box02.OutStart Box08.In1
connect Box02.OutEnd Box10.In1
connect Box05.Out Box02.InMinShow
-connect Box06.Out Box02.InMaxShow
connect Box04.Widget Box11.Widget1
connect Box13.Widget Box12.Widget1
connect Box14.Widget Box12.Widget2
connect Box12.Widget Box11.Widget2
-connect Box13.Out Box08.In
-connect Box14.Out Box10.In
connect Box13.BoxChange Box15.In1
connect Box14.BoxChange Box15.In2
connect Box02.BoxChange Box15.In3
+connect Box06.Out Box02.InMax
+connect Box06.Out Box02.InMaxShow
+connect Box06.Out Box10.In2
+connect Box14.Out Box10.In3
+connect Box16.Out Box05.In
+connect Box17.Out Box06.In
+connect Box17.Out Box10.In
+connect Box16.Out Box18.In
+connect Box02.OutStart Box18.In1
+connect Box05.Out Box18.In2
+connect Box13.Out Box18.In3
# Complex input ports
-input minIn Box05.In " "
-input maxIn Box06.In " "
input showactual Box02.ShowActual " "
+input minIn Box16.In " "
+input maxIn Box17.In " "
# Complex output ports
output outactual Box02.OutActual " "
output outend Box10.Out " "
-output outstart Box08.Out " "
output widget Box11.Widget " "
output boxchange Box15.BoxChange " "
+output outstart Box18.Out " "
message
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 );
bbSetInputWxVtkBaseView(NULL);
bbSetInputWxVtkBaseView1(NULL);
bbSetInputWxVtkBaseView2(NULL);
+
+ std::vector<int> lstColorBarPosition;
+ lstColorBarPosition.push_back(10);
+ lstColorBarPosition.push_back(105);
+ bbSetInputColorBarPosition(lstColorBarPosition);
}
//=====
// Don't edit this file. This file is generated from xml description..
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_PROCESS(Process);
void Process();
BBTK_INPUT(ColorLayerImageView,PlainOrGradientColor,"true=Plane false=Gradient (Default false)",bool,"");
BBTK_INPUT(ColorLayerImageView,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(ColorLayerImageView,ColorBarPosition,"default (10,80)",std::vector<int>,"");
+
BBTK_OUTPUT(ColorLayerImageView,NewImage,"Image with correct Spacing",vtkImageData*,"");
double spc[3];
vtkImageData* img = bbGetInputIn();
if(img!=NULL){
- if(mchange != NULL){
+ if(mchange != NULL)
+ {
mchange->Delete();
}
mchange = vtkImageChangeInformation::New();
img->GetExtent( ext );
-
double origin[3];
origin[0]=0.0;
origin[1]=0.0;
origin[2]=0.0;
-
img->SetOrigin(origin);
-
mchange->SetInput( img );
mchange->SetExtentTranslation( -ext[0], -ext[2], -ext[4] );
mchange->SetOutputOrigin (0, 0, 0);
-
+ mchange->SetOutputExtentStart(0,0,0);
if (bbGetInputNewSpacing().size()==3)
{
spc[0] = bbGetInputNewSpacing()[0];
spc[2] = bbGetInputNewSpacing()[2];
mchange->SetOutputSpacing( spc[0] , spc[1] , spc [2] ); //spacing
}
-
-
mchange->Update(); //important
-
bbSetOutputOut( mchange->GetOutput() );
- }
-
-
+ }
}
+
void ImageChangeInformation::bbUserSetDefaultValues()
{
mchange = NULL;
} // for
}
+//----------------------------------------------------------------------------
+void ColorLayerImageViewManager::SetColorBarPosition(std::vector<int> &colorbarposition)
+{
+ int i, size=_colorLayerImageViewLst.size();
+ for (i=0;i<size;i++)
+ {
+ if (_colorLayerImageViewLst[i]!=NULL)
+ {
+ _colorLayerImageViewLst[i]->SetColorBarPosition( colorbarposition );
+ } // if
+ } // for
+}
+
+
//----------------------------------------------------------------------------
void SetGreyLevelBoundaries(std::vector<double> & grey_level_boundary);
void SetBaseTransparence(std::vector<double> & base_transparence);
void SetRangeForColorBar(std::vector<double> & range);
+ void SetColorBarPosition(std::vector<int> & colorbarposition);
double GetGreyLevelBoundaries(unsigned int index);
void SetPlainOrGradientColor(bool color_type);
int GetBaseColorNb();
_sl_SliceImageZ->Enable(false);
_interpolationCheckBox = new wxCheckBox(this, -1, _T("Interpole") );
_interpolationCheckBox->SetValue(true);
- _opacity = new wxSlider(this, wxID_ANY, 6, 1, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+ _opacity = new wxSlider(this, wxID_ANY, 1, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
// _histogram = new Histogram( this , -1, wxPoint(0,0), wxSize(400,400), /*wxNO_BORDER*/ wxBORDER_DEFAULT );
// _histogramMinMaxLevel = new HistogramMinMaxLevel( (HistogramBase*)_histogram );
sizer = new wxFlexGridSizer(2);
_interpolationCheckBox = new wxCheckBox(this, -1, _T("Interpolate") );
_interpolationCheckBox->SetValue(true);
- _opacity = new wxSlider(this, wxID_ANY, 6, 0, 10, wxDefaultPosition, wxSize(2,40), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+ _opacity = new wxSlider(this, wxID_ANY, 1, 0, 100, wxDefaultPosition, wxSize(2,40), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
Connect( _interpolationCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &ColorLayerImageViewPanel::onThresholdInterpolation );
Connect( _opacity->GetId(), wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) &ColorLayerImageViewPanel::onChangeOpacity );
_layerimagebase->SetX( vtkmprbasedata->GetX() );
_layerimagebase->SetY( vtkmprbasedata->GetY() );
_layerimagebase->SetZ( vtkmprbasedata->GetZ() );
- _layerimagebase->onThresholdChange();
+ _layerimagebase->onThresholdChange();
} // if basedata
} // if wxvtkbaseview
spcBase[5]=0;
_image = image;
+ _image->Update();
_image->GetWholeExtent(ext);
dimensionOriginalLayer[0] = ext[1]-ext[0]+1;
dimensionOriginalLayer[1] = ext[3]-ext[2]+1;
SetZ( dimBase[2]*spcBase[2]/2 );
} // if imagebase
} // if wxvtkbaseview
- _image->Update();
_image->GetScalarRange( _range );
_thresholdTable = vtkLookupTable::New();
}
+//------------------------------------------------------------------------------
+void LayerImageBase::SetColorBarPosition(std::vector<int> &colorbarposition)
+{
+ _colorBarPosition=colorbarposition;
+}
+
//------------------------------------------------------------------------------
void LayerImageBase::SetRangeForColorBar(std::vector<double> &range)
{
z = maxSize;
}
-/*
-
- if ( x > (ext[1]-ext[0]) )
- {
- z=ext[1]-ext[0];
- }
-
- if ( y > (ext[3]-ext[2]) )
- {
- z=ext[3]-ext[2];
- }
-
- if ( z > (ext[5]-ext[4]) )
- {
- z=ext[5]-ext[4];
- }
-*/
-
}
//----------------------------------------------------------------------------
double y=GetY();
double z=GetZ();
+
x = x*_spcBase[0];
y = y*_spcBase[1];
z = z*_spcBase[2];
+
CleanXYZ(x,y,z);
vtkCamera *camera = _baseView->GetRenderer()->GetActiveCamera();
directionViewer = wxvtk2dbasevie->GetDirection();
} // ParallelProjection
+
if (!GetActorPresent())
{
if (_thresholdTable==NULL)
{
_thresholdActor = vtkImageActor::New( );
_scalarbarActor = vtkScalarBarActor::New();
- _thresholdActor->SetOpacity( 0.6 );
+ if (_colorBarPosition.size()==2)
+ {
+ _scalarbarActor->SetDisplayPosition(_colorBarPosition[0],_colorBarPosition[1]);
+ } else {
+ _scalarbarActor->SetDisplayPosition(0,0);
+ }
+
+ _thresholdActor->SetOpacity( 0 );
_thresholdActor->InterpolateOn( );
+
if (directionViewer==0)
{
_thresholdActor->SetPosition( 900-1,0,0 );
{
if (_actorPresent)
{
- _thresholdActor->SetOpacity(opacity*0.1);
+ _thresholdActor->SetOpacity(opacity/100.0);
}
}
vtkImageData* GetImage();
void SetRangeForColorBar(std::vector<double> &range);
void GetRangeForColorBar(double &minRange, double &maxRange);
+ void SetColorBarPosition(std::vector<int> &colorbarposition);
void SetwxVtkBaseView(wxVtkBaseView *baseview);
+
void onThreshold();
void onThresholdChange();
void onThresholdInterpolation(bool interpolate);
vtkLookupTable *GetThresholdTable();
double _range[2];
std::vector<double> _rangeForColorBar;
+ std::vector<int> _colorBarPosition;
+
};