clivp->SetImage( bbGetInputIn() );
+ bbSetOutputNewImage( clivp->GetColorLayerImageViewManager()->GetImageChangeInformation(0) );
+
// std::string msg;
BBTK_DECLARE_INPUT(lstRangeForColorBar,std::vector<double>);
BBTK_DECLARE_INPUT(PlainOrGradientColor,bool);
BBTK_DECLARE_INPUT(FittingMode,int);
+ BBTK_DECLARE_OUTPUT(NewImage,vtkImageData*);
BBTK_PROCESS(Process);
void Process();
BBTK_CREATE_WIDGET(CreateWidget);
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_OUTPUT(ColorLayerImageView,NewImage,"Image with correct Spacing",vtkImageData*,"");
+
+
BBTK_END_DESCRIBE_BLACK_BOX(ColorLayerImageView);
//=====
// Don't edit this file. This file is generated from xml description..
if(bbGetInputIn()!=NULL)
{
- if(_currentimg != bbGetInputIn()){
+// if(_currentimg != bbGetInputIn())
+// {
_currentimg = bbGetInputIn();
//mwxwidget->initializeHistogram(_currentimg);
mwxwidget->setImageData(_currentimg);
//mwxwidget->Refresh();
- }
+// }
// onColorChange();
/*
unsigned int i;
for(i = 0; i < greylevel.size();i++){
_tfun->AddPoint(greylevel[i], value[i]);
- std::cout<<"TransferFunctionView::Process()transfer function "<<greylevel[i]<<" "<< value[i]<<std::endl;
+// std::cout<<"TransferFunctionView::Process()transfer function "<<greylevel[i]<<" "<< value[i]<<std::endl;
}
_ctfun->RemoveAllPoints();
_ctfun->SetScaleToLinear ();
nc = ((greylevelcolors[i]-min)/dif)*w + c-w/2;
// _ctfun->AddRGBPoint(greylevelcolors[i], red[i],green[i], blue[i]);
_ctfun->AddRGBPoint( nc , red[i],green[i], blue[i]);
- std::cout<<"EED TransferFunctionView::Process()transfer color function <<"<<nc<<" "<<red[i]<<" "<<green[i]<<" "<<blue[i]<<std::endl;
+// std::cout<<"EED TransferFunctionView::Process()transfer color function <<"<<nc<<" "<<red[i]<<" "<<green[i]<<" "<<blue[i]<<std::endl;
}
i=greylevelcolors.size()-1;
_ctfun->AddRGBPoint( greylevelcolors[i] , red[i],green[i], blue[i]);
}
void TransferFunctionView::onSliderChange()
- {
-
- //EED
+{
onColorChange();
-
bbSignalOutputModification();
-
-printf("EED TransferFunctionView::onSliderChange --------------------- \n");
-
// bbSetOutputWindowLevel(mwxwidget->GetWindowLevel());
// bbSetOutputColorLevel(mwxwidget->GetColorLevel());
-
}
-/*
-//-----------------------------------------------------
-void TransferFunctionView::onActive()
-{
- bbSignalOutputModification();
-
- printf("EED TransferFunctionView::onActive popopopopopopopop \n");
-}
-*/
//-----------------------------------------------------
void TransferFunctionView::CreateWidget(wxWindow* parent)
_box->onSliderChange();
}
-/*
- void HandlerTransferFunctionView::onActive(wxCommandEvent& event)
- {
- _box->onActive();
- }
-*/
-
}
// EO namespace bbcreaMaracasVisu
void ViewerNV::Process()
{
vtkImageData* img = bbGetInputIn();
-/*
- double spc[3];
- img->GetSpacing(spc);
- printf ("EED ViewerNV::Process A %f %f %f \n", spc[0], spc[1], spc[2] );
- img->SetSpacing( 1,1,1 );
- img->Update( );
- img->GetSpacing(spc);
- img->PrintSelf(std::cout,(vtkIndent)2);
- img->Print(std::cout);
- printf ("EED ViewerNV::Process B %f %f %f \n", spc[0], spc[1], spc[2] );
-*/
+
+
std::vector<int> type = bbGetInputnTypeView();
}else if (img != _currentimg){
_mwxwidget->SetImage(img);
}
-
_mwxwidget->RefreshView();
- _currenttype = type;
- _currentimg = img;
+ _currenttype = type;
+ _currentimg = img;
_point.clear();
_point.push_back((int)_mwxwidget->GetX());
} // for
}
+//----------------------------------------------------------------------------
+vtkImageData* ColorLayerImageViewManager::GetImageChangeInformation(int id)
+{
+ if (_colorLayerImageViewLst[id]!=NULL)
+ {
+ return _colorLayerImageViewLst[id]->GetImage( );
+ } // if
+ return NULL;
+}
+
//----------------------------------------------------------------------------
void ColorLayerImageViewManager::GetDimensionBase(int id,int *dim)
{
void SetSliceFixDynamic( bool fixdin );
void onThresholdChangeOpacity( int opacity );
void SetImage( vtkImageData* img );
+ vtkImageData* GetImageChangeInformation(int id);
- void GetDimensionBase (int id,int *dim);
- void GetSpcBase (int id,double *spc);
- void GetDimensionOriginalLayer (int id,int *dim);
- void GetSpcOriginalLayer (int id,double *spc);
+ void GetDimensionBase (int id,int *dim);
+ void GetSpcBase (int id,double *spc);
+ void GetDimensionOriginalLayer (int id,int *dim);
+ void GetSpcOriginalLayer (int id,double *spc);
void SetNewSpacingLayer(double *spc);
private:
GetColorLayerImageViewManager()->GetSpcBase(0,spcBase);
GetColorLayerImageViewManager()->GetDimensionBase(0,dimensionBase);
-/*
- int dim[3];
- int ext[6];
- img->GetWholeExtent(ext);
- dim[0] = ext[1]-ext[0]+1;
- dim[1] = ext[3]-ext[2]+1;
- dim[2] = ext[5]-ext[4]+1;
-*/
-
if (_sl_SliceImageX!=NULL)
{
_sl_SliceImageX->SetRange( 0 , dimensionOriginalLayer[0] );
_sl_SliceImageZ->SetRange( 0 , dimensionOriginalLayer[2] );
}
-/*
-printf("EED ColorLayerImageViewPanel::SetImage UUPPSS----------------------\n" );
-printf("EED ColorLayerImageViewPanel::SetImage UUPPSS----------------------\n" );
-printf("EED ColorLayerImageViewPanel::SetImage UUPPSS----------------------\n" );
-printf("EED ColorLayerImageViewPanel::SetImage UUPPSS----------------------\n" );
-printf(" Here I have to analyse the spacing and size image to calculate new spacingvv\n" );
-printf(" I need the caracteristics of the base image\n" );
-
- wxVtkBaseView *wxvtkbaseview = GetColorLayerImageViewManager()->GetwxVtkBaseView(0);
- if (wxvtkbaseview!=NULL)
- {
- vtkImageData *imagebase = wxvtkbaseview->GetVtkBaseData()->GetImageData();
- if (imagebase!=NULL)
- {
- imagebase->GetSpacing(_spcBase);
- int ext[6];
- imagebase->GetWholeExtent(ext);
- _dimBase[0]=ext[1]-ext[0]+1;
- _dimBase[1]=ext[3]-ext[2]+1;
- _dimBase[2]=ext[5]-ext[4]+1;
- } // if imagebase
- } // if wxvtkbaseview
-
-*/
-
if ( (spcOriginalLayer[0]!=spcBase[0]) ||
(spcOriginalLayer[1]!=spcBase[1]) ||
//EO CM
if (typeOfTransformation==1) // Adapt spacing
{
-printf("EED ColorLayerImageViewPanel::SetImag 1 \n");
newSpc[0] = spcBase[0] * dimensionBase[0] / dimensionOriginalLayer[0];
newSpc[1] = spcBase[1] * dimensionBase[1] / dimensionOriginalLayer[1];
newSpc[2] = spcBase[2] * dimensionBase[2] / dimensionOriginalLayer[2];
-printf("EED ColorLayerImageViewPanel::SetImag 1 newSpc=%f %f %f \n", newSpc[0],newSpc[1],newSpc[2] );
}
if (typeOfTransformation==2) // keep spacing of the Layer Image
{
-printf("EED ColorLayerImageViewPanel::SetImag 2 \n");
newSpc[0] = spcOriginalLayer[0];
newSpc[1] = spcOriginalLayer[1];
newSpc[2] = spcOriginalLayer[2];
if (typeOfTransformation==3) // Use the spacing of the Base Image
{
-printf("EED ColorLayerImageViewPanel::SetImag 3 \n");
newSpc[0] = spcBase[0];
newSpc[1] = spcBase[1];
newSpc[2] = spcBase[2];
-// spc[0] = 1;
-// spc[1] = 1;
-// spc[2] = 1;
}
-
-
GetColorLayerImageViewManager()->SetNewSpacingLayer(newSpc);
+ } else {
+ newSpc[0] = spcOriginalLayer[0];
+ newSpc[1] = spcOriginalLayer[1];
+ newSpc[2] = spcOriginalLayer[2];
+ } // spc !_spcBase dim!__dimBase
+
+ GetColorLayerImageViewManager()->SetNewSpacingLayer(newSpc);
-// img->SetSpacing(newSpc);
-// img->Update();
-// img->Modified();
- } // spc !_spcBase dim!__dimBase
} // _firsttime_mode
if (_active==true)
vtkImageData* LayerImageBase::GetImage()
{
// return _image;
- return _imageChangeInformation->GetOutput();
+ vtkImageData *result;
+ if (_image==NULL)
+ {
+ result = NULL;
+ } else {
+ result = _imageChangeInformation->GetOutput();
+ }
+ return result;
}
//----------------------------------------------------------------------------
{
if ((_image!=NULL) && (_baseView!=NULL))
{
-double spc[3];
-GetImage()-> GetSpacing(spc);
-printf("EED LayerImageBase::onThreshold A img-spc %f %f %f\n", spc[0],spc[1],spc[2]);
double x=GetX();
double y=GetY();
double z=GetZ();
-// x = x*spc[0];
-// y = y*spc[1];
-// z = z*spc[2];
-
-
x = x*_spcBase[0];
y = y*_spcBase[1];
z = z*_spcBase[2];
-
CleanXYZ(x,y,z);
-
vtkCamera *camera = _baseView->GetRenderer()->GetActiveCamera();
int directionViewer=0;
if (camera->GetParallelProjection()==1)
directionViewer = wxvtk2dbasevie->GetDirection();
} // ParallelProjection
-
if (!GetActorPresent())
{
if (_thresholdTable==NULL)
// _scalarbarActor->SetTextPad(4); ??
-GetImage()-> GetSpacing(spc);
-printf("EED LayerImageBase::onThreshold B img-spc %f %f %f\n", spc[0],spc[1],spc[2]);
-
} // _image
}
public:
LayerImageBase();
virtual ~LayerImageBase();
- void SetX(int x);
- void SetY(int y);
- void SetZ(int z);
- void SetImage(vtkImageData* image);
- void SetRangeForColorBar(std::vector<double> &range);
- void GetRangeForColorBar(double &minRange, double &maxRange);
- void SetwxVtkBaseView(wxVtkBaseView *baseview);
+ void SetX(int x);
+ void SetY(int y);
+ void SetZ(int z);
+ void SetImage(vtkImageData* image);
+ vtkImageData* GetImage();
+ void SetRangeForColorBar(std::vector<double> &range);
+ void GetRangeForColorBar(double &minRange, double &maxRange);
+ void SetwxVtkBaseView(wxVtkBaseView *baseview);
void onThreshold();
void onThresholdChange();
protected:
vtkLookupTable *GetThresholdTable();
- vtkImageData *GetImage();
double _range[2];
std::vector<double> _rangeForColorBar;
};