// bbSetOutputOut( bbGetInputIn() );
// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
-printf("EED ShowNPoints_Reset::Process Start\n");
bbGetInputWidgetShowNPoints()->DeleteAllPoints();
bbGetInputWidgetShowNPoints()->GetModelShowNPoints()->SetFirstTime(true);
-
-printf("EED ShowNPoints_Reset::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 ShowNPoints::Process()
{
-printf("EED ShowNPoints::Process Start\n");
if (mwxwidget!=NULL)
{
mwxwidget->SetRenderer( bbGetInputRenderer() );
if ( mwxwidget->GetModelShowNPoints()->GetFirstTime()==true )
{
-printf("EED ShowNPoints::Process firsttime\n");
mwxwidget->GetModelShowNPoints()->SetFirstTime(false);
mwxwidget->SetInitLstPoints( bbGetInputInitLstPointsX() , bbGetInputInitLstPointsY() , bbGetInputInitLstPointsZ() , bbGetInputInitLstLabels() );
}
bbSetOutputlstLabels( mwxwidget->GetModelShowNPoints()->GetLstLabels() );
bbSetOutputWidgetShowNPoints( (WidgetShowNPoints*)mwxwidget );
} // mwxwidget
-printf("EED ShowNPoints::Process End\n");
}
//-----------------------------------------------------------------
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,Type,"Type of the widget. 0(default): N-points, 1:Just one point",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",int,"");
BBTK_OUTPUT(ShowNPoints , lstPointsX , " list of points X ", std::vector<int> ,"");
BBTK_OUTPUT(ShowNPoints , lstPointsY , " list of points Y ", std::vector<int> ,"");
{
unsigned short *pValue;
unsigned short *pMask;
- pValue = (unsigned short *)imagedataValueResult->GetScalarPointer(x,y,z);
- pMask = (unsigned short *)imagedataMaskResult->GetScalarPointer(x,y,z);
- *pMask = 255;
- *pValue = (unsigned short)value;
+//EED 2017-12-18
+ imagedataValueResult->SetScalarComponentFromDouble(x,y,z,0,value);
+ imagedataMaskResult->SetScalarComponentFromDouble(x,y,z,0,255);
+// pValue = (unsigned short *)imagedataValueResult->GetScalarPointer(x,y,z);
+// *pValue = (unsigned short)value;
+// pMask = (unsigned char *)imagedataMaskResult->GetScalarPointer(x,y,z);
+// *pMask = 255;
}
//------------------------------------------------------------------------
imagedataValueResult->GetExtent(ext);
int size = (ext[1]-ext[0]+1) * (ext[3]-ext[2]+1);
- memset(pValue,0,size*2);
- memset(pMask,0,size*2);
+ memset(pValue,0, size*imagedataValueResult->GetScalarSize() );
+ memset(pMask,0, size*imagedataMaskResult->GetScalarSize() );
} // if
}
imagedataValueResult->Delete();
}
imagedataValueResult = vtkImageData::New();
- // imagedataValueResult->SetScalarType(scalartype);
- imagedataValueResult->SetScalarTypeToUnsignedShort();
+
+//EED 2017-12-18
+ imagedataValueResult->SetScalarType(scalartype);
+ //imagedataValueResult->SetScalarTypeToUnsignedShort();
+
imagedataValueResult->SetSpacing(spc);
imagedataValueResult->SetDimensions( newDim );
imagedataValueResult->AllocateScalars();
imagedataMaskResult->Delete();
}
imagedataMaskResult = vtkImageData::New();
- // imagedataMaskResult->SetScalarType(scalartype);
- imagedataMaskResult->SetScalarTypeToUnsignedShort();
+
+//EED 2017-12-18
+// imagedataMaskResult->SetScalarType(scalartype);
+// imagedataMaskResult->SetScalarTypeToUnsignedShort();
+ imagedataMaskResult->SetScalarTypeToUnsignedChar();
+
imagedataMaskResult->SetSpacing(spc);
imagedataMaskResult->SetDimensions( newDim );
imagedataMaskResult->AllocateScalars();
end = GrayLevel_TO_colorTableIndex( GetGreyLevelBoundaries(iColor+1) );
t1 = _transparence_level_boundary[iColor];
t2 = _transparence_level_boundary[iColor+1];
-printf("EED ColorLayerImageView::ConfigLookupTable Make something with transparence \n");
+//printf("EED ColorLayerImageView::ConfigLookupTable Make something with transparence \n");
FillColorTable( start,end, r1,g1,b1, r2,g2,b2, t1,t2 );
}// for
} //if
_X = -1;
_Y = -1;
_Z = -1;
+ _opacity = 1;
_thresholdTable = NULL;
_thresholdMapper = NULL;
_scalarbarActor = NULL;
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();
_thresholdMapper->SetInput( img );
_thresholdMapper->SetLookupTable( _thresholdTable );
_thresholdActor->SetInput( _thresholdMapper->GetOutput() );
-
+ _thresholdActor->SetOpacity(_opacity);
+
_scalarbarActor->SetLookupTable( _thresholdTable );
// _scalarbarActor->SetLookupTable( _thresholdMapper->GetLookupTable() );
_scalarbarActor->SetTitle("Value");
{
_thresholdActor->SetOpacity(opacity/100.0);
}
+// EED 2017-12-17
+ _opacity = (double)opacity/100.0;
}
//----------------------------------------------------------------------------
double _newSpcLayer[3];
int _dimBase[3];
double _spcBase[3];
+ double _opacity;
vtkImageData *_image;
vtkImageChangeInformation *_imageChangeInformation;
/**
** Begin of the threshold panel
**/
-ThresholdImageViewPanel::ThresholdImageViewPanel(wxWindow* parent, int min, int max, int type)
+ThresholdImageViewPanel::ThresholdImageViewPanel(wxWindow* parent, int min, int max, int start, int end, int type)
: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
{
_thresholdImageView = new ThresholdImageView();
_interpolationCheckBox = new wxCheckBox(this, -1, _T("Image interpolation") );
_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, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
// double range[2];
// interfMainPanel::getInstance()->getImageRange(range);
_mBarThreshold-> setRepresentedValues( min , max );
_mBarThreshold-> setDeviceBlitStart(10,10);
_mBarThreshold-> setIfWithActualDrawed( false );
- _mBarThreshold-> SetStart( min );
- _mBarThreshold-> SetEnd( max );
+ _mBarThreshold-> SetStart( start );
+ _mBarThreshold-> SetEnd( end );
}
: public wxPanel
{
public:
- ThresholdImageViewPanel(wxWindow * parent, int min, int max, int type);
+ ThresholdImageViewPanel(wxWindow * parent, int min, int max, int start, int end, int type);
~ThresholdImageViewPanel();
void onThresholdStop();
void SetThresholdImageView(ThresholdImageView* thresholdImageView);
wxPanel *panel = this;
wxSizer *sizer = NULL;
- if (mtype==0)
+ if ((mtype==0) || (mtype==3))
{
// Widget interface
askPointLabel = new wxStaticText(panel, -1, _T("Point label :")); // JPR
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 = new wxButton( panel, -1, _T("Save points"));
- wxButton *btnLoadPoints = new wxButton( panel, -1, _T("Load points"));
+ wxButton *btnSavePoints = NULL;
+ wxButton *btnLoadPoints = NULL;
+ if (mtype==0)
+ {
+ btnSavePoints = new wxButton( panel, -1, _T("Save points"));
+ btnLoadPoints = new wxButton( panel, -1, _T("Load points"));
+ }
txtNrPoints = new wxStaticText(panel,-1, _T(" "));
//NTU: Sliders for opacity and radio change
Connect(btnEraseLastPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnEraseLastPoint);
Connect(btnErasePoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnErasePoint);
Connect(btnDeleteAllPoints->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnDeleteAllPoints);
- Connect(btnSavePoints->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnSavePoints);
- Connect(btnLoadPoints->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnLoadPoints);
-
+ if (mtype==0)
+ {
+ Connect(btnSavePoints->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnSavePoints);
+ Connect(btnLoadPoints->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnLoadPoints);
+ }
//NTU: Slider events
Connect(sdrOpacity->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
Connect(sdrRadio->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
sizer1->Add(sdrOpacity,1,wxGROW );
sizer1->Add(txRadio);
sizer1->Add(sdrRadio,1,wxGROW );
- sizer1->Add(btnSavePoints);
- sizer1->Add(btnLoadPoints);
+ if (mtype==0)
+ {
+ sizer1->Add(btnSavePoints);
+ sizer1->Add(btnLoadPoints);
+ }
sizer = sizer1;
}
this->Refresh();
}
+//-------------------------------------------------------------------
+void wxVtk2DBaseView::SetInterpolate(bool iterpolate)
+{
+ GetVtkBaseData()->SetInterpolate( iterpolate );
+ this->Refresh();
+}
+
//-------------------------------------------------------------------
int wxVtk2DBaseView::GetDirection() // virtual
{
void setColorTransferFunction(vtkColorTransferFunction* colortable);
void SetColorWindow(double level);
void SetColorLevel(double level);
+ void SetInterpolate(bool iterpolate);
virtual int GetDirection();
void SetImageToVtkViewer(vtkImageData *imageData);