+/*# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+# pour la Sant�)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+# This software is governed by the CeCILL-B license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL-B
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+# or in the file LICENSE.txt.
+#
+# As a counterpart to the access to the source code and rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+#
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------ */
/**
* \file
#include "LayerImageBase.h"
+
+//---------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------
+
+ColorLayerImageBasevtkInteractor::ColorLayerImageBasevtkInteractor(LayerImageBase* layerImageBase)
+{
+ _layerImageBase=layerImageBase;
+}
+
+//---------------------------------------------------------------------------------------------
+ColorLayerImageBasevtkInteractor::~ColorLayerImageBasevtkInteractor()
+{
+}
+
+
+//---------------------------------------------------------------------------------------------
+bool ColorLayerImageBasevtkInteractor::OnMouseMove()
+{
+ printf("EED ColorLayerImageBasevtkInteractor::OnMouseMove \n");
+ if (_vtkInteractorStyleBaseView->GetRefresh_waiting()==true)
+ {
+ _layerImageBase->GetvtkImageReslice()->Modified();
+ }
+
+ return true;
+}
+
+
+//---------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------
+
+
+
LayerImageBase::LayerImageBase()
{
_actorPresent = false;
- _Z = 0;
+ _Z = 0;
_thresholdTable = NULL;
_thresholdMapper = NULL;
_thresholdActor = NULL;
- _image = NULL;
- _baseView = NULL;
+ _image = NULL;
+ _baseView = NULL;
_imageReslicer = vtkImageReslice::New();
}
//----------------------------------------------------------------------------
void LayerImageBase::SetwxVtkBaseView(wxVtkBaseView *baseview)
{
+ printf("EED LayerImageBase::SetwxVtkBaseView start baseview:%p \n", baseview);
+
_baseView = baseview;
+
+ vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*)(_baseView->GetInteractorStyleBaseView());
+ isbv->AddInteractorStyleMaracas( new ColorLayerImageBasevtkInteractor(this) );
+
+ printf("EED LayerImageBase::SetwxVtkBaseView end \n");
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
void LayerImageBase::Refresh()
{
+ printf("EED LayerImageBase::Refresh\n");
if (_baseView!=NULL)
{
_baseView->Refresh();
//----------------------------------------------------------------------------
void LayerImageBase::onThreshold()
{
-
+
+ printf("EED LayerImageBase::onThreshold start \n");
+
if ((_image!=NULL) && (_baseView!=NULL))
{
int z=CleanZ( GetZ() );
_thresholdActor = vtkImageActor::New( );
_thresholdActor->SetOpacity( 0.6 );
_thresholdActor->InterpolateOn( );
- _thresholdActor->SetPosition( 0,0, 900-1 );
+ _thresholdActor->SetPosition( 0,0, -900-1 );
} // _thresholdActor
_baseView->GetRenderer()->AddActor( _thresholdActor );
_actorPresent = true;
_imageReslicer->SetInformationInput( GetImage() );
_imageReslicer->SetResliceAxesDirectionCosines(1,0,0, 0,1,0 ,0,0,1);
_imageReslicer->SetOutputDimensionality(2);
- _imageReslicer->SetInterpolationModeToLinear();
+// _imageReslicer->SetInterpolationModeToLinear();
+ _imageReslicer->SetInterpolationModeToNearestNeighbor();
_imageReslicer->SetResliceAxesOrigin(0,0,z);
vtkImageData *img = _imageReslicer->GetOutput();
_thresholdMapper->SetInput( img );
_thresholdMapper->SetLookupTable( _thresholdTable );
_thresholdActor->SetInput( _thresholdMapper->GetOutput() );
+
+ printf("EED LayerImageBase::onThreshold working \n");
+
+
} // _image
+ printf("EED LayerImageBase::onThreshold end");
}
}
}
+//----------------------------------------------------------------------------
+vtkLookupTable *LayerImageBase::GetvtkLookupTable()
+{
+ return _thresholdTable;
+}
+
+vtkImageReslice *LayerImageBase::GetvtkImageReslice()
+{
+ return _imageReslicer;
+}