//------------------------------------------------------------------------------
vvBinaryImageOverlayActor::vvBinaryImageOverlayActor()
-{
+{ cout << __func__ << endl;
mTSlice = -1;
mSlice = 0;
mColor.resize(3);
//------------------------------------------------------------------------------
vvBinaryImageOverlayActor::~vvBinaryImageOverlayActor()
-{
+{ cout << __func__ << endl;
mImageActorList.clear();
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvBinaryImageOverlayActor::RemoveActors()
-{
+{ cout << __func__ << endl;
for (unsigned int i = 0; i < mImageActorList.size(); i++) {
if (mSlicer != 0) {
if (mSlicer != NULL) {
//------------------------------------------------------------------------------
void vvBinaryImageOverlayActor::SetColor(double r, double g, double b)
-{
+{ cout << __func__ << endl;
mColor[0] = r;
mColor[1] = g;
mColor[2] = b;
//------------------------------------------------------------------------------
void vvBinaryImageOverlayActor::SetSlicer(vvSlicer * slicer)
-{
+{ cout << __func__ << endl;
mSlicer = slicer;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvBinaryImageOverlayActor::Initialize(bool IsVisible)
-{
+{ cout << __func__ << endl;
if (!mSlicer) {
std::cerr << "ERROR. Please use setSlicer before setSlicer in vvBinaryImageOverlayActor." << std::endl;
exit(0);
//------------------------------------------------------------------------------
void vvBinaryImageOverlayActor::SetOpacity(double d)
-{
+{ cout << __func__ << endl;
mAlpha = d;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvBinaryImageOverlayActor::SetImage(vvImage::Pointer image, double bg, bool modeBG)
-{
+{ cout << __func__ << endl;
mImage = image;
if (modeBG) {
mBackgroundValue = bg;
//------------------------------------------------------------------------------
void vvBinaryImageOverlayActor::HideActors()
-{
+{ cout << __func__ << endl;
if (!mSlicer) return;
mSlice = mSlicer->GetSlice();
for(unsigned int i=0; i<mImageActorList.size(); i++) {
//------------------------------------------------------------------------------
void vvBinaryImageOverlayActor::ShowActors()
-{
+{ cout << __func__ << endl;
if (!mSlicer) return;
mSlice = mSlicer->GetSlice();
mTSlice = mSlicer->GetTSlice();
//------------------------------------------------------------------------------
void vvBinaryImageOverlayActor::UpdateColor()
-{
+{ cout << __func__ << endl;
mColorLUT->SetTableValue(1, mColor[0], mColor[1], mColor[2], mAlpha); // FG
for (unsigned int numImage = 0; numImage < mSlicer->GetImage()->GetVTKImages().size(); numImage++) {
// how many intensity ?
//------------------------------------------------------------------------------
void vvBinaryImageOverlayActor::UpdateSlice(int slicer, int slice, bool force)
-{
+{ cout << __func__ << endl;
if (!mSlicer) return;
if (!force) {
#else
mSlicer->ClipDisplayedExtent(maskExtent, mMapperList[mTSlice]->GetInput()->GetInformation()->Get(vtkDataObject::DATA_EXTENT()));
#endif
+mSlicer->Print(cout);
SetDisplayExtentAndCameraPosition(orientation, mSlice, maskExtent, mImageActorList[mTSlice], mDepth);
// set previous slice
int slice,
int * inExtent,
int * outExtent)
-{
+{ cout << __func__ << endl;
switch (orientation) {
case vtkImageViewer2::SLICE_ORIENTATION_XY:
for(int i=0; i<4; i++) outExtent[i] = inExtent[i];
//----------------------------------------------------------------------------
void vvBinaryImageOverlayActor::ComputeExtent(int * inExtent, int * outExtent, vtkImageData * image, vtkImageData * overlay)
-{
+{ cout << __func__ << endl;
for(int i=0; i<3; i++) {
double a = (image->GetOrigin()[i] + inExtent[i*2]*image->GetSpacing()[i] -
overlay->GetOrigin()[i]) / overlay->GetSpacing()[i];
int * extent,
vtkImageActor * actor,
double position)
-{
+{ cout << __func__ << endl;
/* FIXME
Error according to camera orientation
*/
//------------------------------------------------------------------------------
vvImageContour::vvImageContour()
-{
+{ //out << __func__ << endl;
mTSlice = -1;
mSlice = 0;
mHiddenImageIsUsed = false;
//------------------------------------------------------------------------------
vvImageContour::~vvImageContour()
-{
+{ //out << __func__ << endl;
mSquaresActorList.clear();
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvImageContour::RemoveActors()
-{
+{ //out << __func__ << endl;
for (unsigned int i = 0; i < mSquaresActorList.size(); i++) {
if (mSlicer != 0) {
if (mSlicer!= NULL) {
//------------------------------------------------------------------------------
-void vvImageContour::SetSlicer(vvSlicer * slicer) {
+void vvImageContour::SetSlicer(vvSlicer * slicer)
+{ //out << __func__ << endl;
mSlicer = slicer;
// Create an actor for each time slice
for (unsigned int numImage = 0; numImage < mSlicer->GetImage()->GetVTKImages().size(); numImage++) {
//------------------------------------------------------------------------------
-void vvImageContour::SetImage(vvImage::Pointer image) {
+void vvImageContour::SetImage(vvImage::Pointer image)
+{ //out << __func__ << endl;
for (unsigned int numImage = 0; numImage < image->GetVTKImages().size(); numImage++) {
#if VTK_MAJOR_VERSION <= 5
mClipperList[numImage]->SetInput(image->GetVTKImages()[numImage]);
//------------------------------------------------------------------------------
-void vvImageContour::SetPreserveMemoryModeEnabled(bool b) {
+void vvImageContour::SetPreserveMemoryModeEnabled(bool b)
+{ //out << __func__ << endl;
// FastCache mode work only if threshold is always the same
if (mDisplayModeIsPreserveMemory == b) return;
mDisplayModeIsPreserveMemory = b;
//------------------------------------------------------------------------------
-void vvImageContour::SetColor(double r, double g, double b) {
+void vvImageContour::SetColor(double r, double g, double b)
+{ //out << __func__ << endl;
for(unsigned int i=0; i<mSquaresActorList.size(); i++) {
mSquaresActorList[i]->GetProperty()->SetColor(r,g,b);
}
//------------------------------------------------------------------------------
void vvImageContour::SetLineWidth(double w)
-{
+{ //out << __func__ << endl;
for(unsigned int i=0; i<mSquaresActorList.size(); i++) {
mSquaresActorList[i]->GetProperty()->SetLineWidth(w);
}
//------------------------------------------------------------------------------
-void vvImageContour::HideActors() {
+void vvImageContour::HideActors()
+{ //out << __func__ << endl;
if (!mSlicer) return;
mSlice = mSlicer->GetSlice();
for(unsigned int i=0; i<mSquaresActorList.size(); i++) {
//------------------------------------------------------------------------------
-void vvImageContour::ShowActors() {
+void vvImageContour::ShowActors()
+{ //out << __func__ << endl;
if (!mSlicer) return;
mSlice = mSlicer->GetSlice();
mTSlice = mSlicer->GetTSlice();
//------------------------------------------------------------------------------
void vvImageContour::SetDepth(double d)
-{
+{ //out << __func__ << endl;
mDepth = d;
// Move the actor to be visible
double position[3] = {0, 0, 0};
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-void vvImageContour::Update(double value) {
+void vvImageContour::Update(double value)
+{ //out << __func__ << endl;
if (!mSlicer) return;
if (mPreviousValue == value) {
if (mPreviousSlice == mSlicer->GetSlice()) {
//------------------------------------------------------------------------------
-void vvImageContour::UpdateWithPreserveMemoryMode() {
+void vvImageContour::UpdateWithPreserveMemoryMode()
+{ //out << __func__ << endl;
// Only change actor visibility if tslice change
mPreviousTslice = mTSlice;
mTSlice = mSlicer->GetTSlice();
vtkActor * mSquaresActor = mSquaresActorList[mTSlice];
int orientation = ComputeCurrentOrientation();
- UpdateActor(mSquaresActor, mapper, mSquares, mClipper, mValue, orientation, mSlice);
+ //UpdateActor(mSquaresActor, mapper, mSquares, mClipper, mValue, orientation, mSlice);
if (mPreviousTslice != mTSlice) {
if (mPreviousTslice != -1) mSquaresActorList[mPreviousTslice]->VisibilityOff();
//------------------------------------------------------------------------------
-void vvImageContour::InitializeCacheMode() {
+void vvImageContour::InitializeCacheMode()
+{ //out << __func__ << endl;
clitkExceptionMacro("TODO : not implemented yet");
mPreviousSlice = mPreviousOrientation = 0;
int dim = mSlicer->GetImage()->GetNumberOfDimensions();
//------------------------------------------------------------------------------
-int vvImageContour::ComputeCurrentOrientation() {
+int vvImageContour::ComputeCurrentOrientation()
+{ //out << __func__ << endl;
// Get extent of image in the slicer
int* extent = mSlicer->GetImageActor()->GetDisplayExtent();
//------------------------------------------------------------------------------
-void vvImageContour::UpdateWithFastCacheMode() {
+void vvImageContour::UpdateWithFastCacheMode()
+{ //out << __func__ << endl;
clitkExceptionMacro("TODO : not implemented yet");
// Compute orientation
//------------------------------------------------------------------------------
-void vvImageContour::CreateNewActor(int numImage) {
+void vvImageContour::CreateNewActor(int numImage)
+{ //out << __func__ << endl;
vtkSmartPointer<vtkActor> squaresActor = vtkSmartPointer<vtkActor>::New();
vtkSmartPointer<vtkImageClip> clipper = vtkSmartPointer<vtkImageClip>::New();
vtkSmartPointer<vtkMarchingSquares> squares = vtkSmartPointer<vtkMarchingSquares>::New();
clipper->SetInputData(mSlicer->GetImage()->GetVTKImages()[numImage]);
#endif
}
-
+clipper->Update();
#if VTK_MAJOR_VERSION <= 5
squares->SetInput(clipper->GetOutput());
squaresMapper->SetInput(squares->GetOutput());
squares->SetInputData(clipper->GetOutput());
squaresMapper->SetInputData(squares->GetOutput());
#endif
+squares->Update();
+squaresMapper->Update();
squaresMapper->ScalarVisibilityOff();
squaresActor->SetMapper(squaresMapper);
squaresActor->GetProperty()->SetColor(1.0,0,0);
vtkPolyDataMapper * mapper,
vtkMarchingSquares * squares,
vtkImageClip * clipper,
- double threshold, int orientation, int slice) {
+ double threshold, int orientation, int slice)
+{ //out << __func__ << endl;
// Set parameter for the MarchigSquare
squares->SetValue(0, threshold);
-
+
// Get image extent
int* extent = mSlicer->GetImageActor()->GetDisplayExtent();
extent2 = extent;
actor->VisibilityOn();
}
-
+
clipper->SetOutputWholeExtent(extent2[0],extent2[1],extent2[2],
extent2[3],extent2[4],extent2[5]);
+ clipper->Update();
+ clipper->Print(cout);
if (mHiddenImageIsUsed) delete extent2;
//------------------------------------------------------------------------------
vvROIActor::vvROIActor()
-{
+{ //out << __func__ << endl;
mIsVisible = true;
mIsContourVisible = false;
mOpacity = 0.5;
//------------------------------------------------------------------------------
vvROIActor::~vvROIActor()
-{
+{ //out << __func__ << endl;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvROIActor::RemoveActors()
-{
+{ //out << __func__ << endl;
for(unsigned int i= 0; i<mOverlayActors.size(); i++) {
mOverlayActors[i]->RemoveActors();
}
//------------------------------------------------------------------------------
void vvROIActor::SetROI(clitk::DicomRT_ROI * s)
-{
+{ //out << __func__ << endl;
mROI = s;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-void vvROIActor::SetContourWidth(int n) {
+void vvROIActor::SetContourWidth(int n)
+{ //out << __func__ << endl;
mContourWidth = n;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-void vvROIActor::SetSlicerManager(vvSlicerManager * s) {
+void vvROIActor::SetSlicerManager(vvSlicerManager * s)
+{ //out << __func__ << endl;
mSlicerManager = s;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvROIActor::UpdateImage()
-{
+{ //out << __func__ << endl;
mOverlayActors.clear();
mImageContour.clear();
Initialize(mDepth, mIsVisible);
//------------------------------------------------------------------------------
void vvROIActor::SetVisible(bool b)
-{
+{ //out << __func__ << endl;
mIsVisible = b;
if (!b) { // remove actor
for(unsigned int i= 0; i<mOverlayActors.size(); i++)
//------------------------------------------------------------------------------
-void vvROIActor::SetContourVisible(bool b) {
+void vvROIActor::SetContourVisible(bool b)
+{ //out << __func__ << endl;
mIsContourVisible = b;
if (!b) { // remove actor
for(unsigned int i= 0; i<mImageContour.size(); i++) {
//------------------------------------------------------------------------------
-bool vvROIActor::IsVisible() {
+bool vvROIActor::IsVisible()
+{ //out << __func__ << endl;
return mIsVisible;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-bool vvROIActor::IsContourVisible() {
+bool vvROIActor::IsContourVisible()
+{ //out << __func__ << endl;
return mIsContourVisible;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-void vvROIActor::Initialize(double depth, bool IsVisible) {
+void vvROIActor::Initialize(double depth, bool IsVisible)
+{ //out << __func__ << endl;
if (mROI->GetImage()) {
mImageContour.clear();
mOverlayActors.clear();
mImageContour[i]->SetLineWidth(mContourWidth);
mImageContour[i]->SetPreserveMemoryModeEnabled(true);
mImageContour[i]->SetDepth(mDepth+0.5);
- mImageContour[i]->HideActors();
+ mImageContour[i]->ShowActors();
mOverlayActors.push_back(vvBinaryImageOverlayActor::New());
mOverlayActors[i]->Initialize(IsVisible);
mOverlayActors[i]->SetDepth(mDepth);
}
-
connect(mSlicerManager,SIGNAL(UpdateSlice(int,int)),this,SLOT(UpdateSlice(int, int)));
//connect(mSlicerManager,SIGNAL(UpdateTSlice(int,int)),this,SLOT(UpdateSlice(int, int)));
connect(mSlicerManager, SIGNAL(AVerticalSliderHasChanged(int, int)), SLOT(UpdateSlice(int, int)));
//------------------------------------------------------------------------------
void vvROIActor::SetDepth(double d)
-{
+{ //out << __func__ << endl;
mDepth = d;
if (!mSlicerManager) return;
for(int i=0; i<mSlicerManager->GetNumberOfSlicers(); i++) {
//------------------------------------------------------------------------------
void vvROIActor::Update(bool force)
-{
+{ //out << __func__ << endl;
if (!mSlicerManager) return;
for(int i=0; i<mSlicerManager->GetNumberOfSlicers(); i++) {
UpdateSlice(i, mSlicerManager->GetSlicer(i)->GetSlice(), force);
//------------------------------------------------------------------------------
void vvROIActor::UpdateSlice(int slicer, int slices, bool force)
-{
+{ //out << __func__ << endl;
if (!mROI->GetImage()) return;
if ((!mIsVisible) && (!mIsContourVisible)) return;
if (!mSlicerManager) {
//------------------------------------------------------------------------------
void vvROIActor::SetOpacity(double d)
-{
+{ //out << __func__ << endl;
mOpacity = d;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-void vvROIActor::SetContourColor(double r, double v, double b) {
+void vvROIActor::SetContourColor(double r, double v, double b)
+{ //out << __func__ << endl;
mContourColor[0] = r;
mContourColor[1] = v;
mContourColor[2] = b;
//------------------------------------------------------------------------------
-void vvROIActor::SetOverlayColor(double r, double v, double b) {
+void vvROIActor::SetOverlayColor(double r, double v, double b)
+{ //out << __func__ << endl;
if (mROI)
mROI->SetDisplayColor(r,v,b);
}
//------------------------------------------------------------------------------
-std::vector<double> & vvROIActor::GetContourColor() {
+std::vector<double> & vvROIActor::GetContourColor()
+{ //out << __func__ << endl;
return mContourColor;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-std::vector<double> & vvROIActor::GetOverlayColor() {
+std::vector<double> & vvROIActor::GetOverlayColor()
+{ //out << __func__ << endl;
return mROI->GetDisplayColor();
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-void vvROIActor::UpdateColor() {
+void vvROIActor::UpdateColor()
+{ //out << __func__ << endl;
for(unsigned int i=0; i<mOverlayActors.size(); i++) {
mOverlayActors[i]->SetOpacity(mOpacity);
mOverlayActors[i]->SetColor(mROI->GetDisplayColor()[0],
//------------------------------------------------------------------------------
double vvROIActor::GetOpacity()
-{
+{ //out << __func__ << endl;
return mOpacity;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvROIActor::SetSelected(bool b)
-{
+{ //out << __func__ << endl;
mIsSelected = b;
if (b) {
for(int i=0; i<mSlicerManager->GetNumberOfSlicers(); i++) {
//------------------------------------------------------------------------------
void vvROIActor::CopyParameters(QSharedPointer<vvROIActor> roi)
-{
+{ //out << __func__ << endl;
// Overlay
SetVisible(roi->IsVisible());
SetOpacity(roi->GetOpacity());
//------------------------------------------------------------------------------
void vvToolBinarize::Initialize()
-{
+{ cout << __func__ << endl;
SetToolName("Binarize");
SetToolMenuName("Binarize");
SetToolIconFilename(":/common/icons/binarize.png");
:vvToolWidgetBase(parent,f),
vvToolBase<vvToolBinarize>(parent),
Ui::vvToolBinarize()
-{
+{ cout << __func__ << endl;
// GUI Initialization
Ui_vvToolBinarize::setupUi(mToolWidget);
mInteractiveDisplayIsEnabled = mCheckBoxInteractiveDisplay->isChecked();
//------------------------------------------------------------------------------
vvToolBinarize::~vvToolBinarize()
-{
+{ cout << __func__ << endl;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolBinarize::InteractiveDisplayToggled(bool b)
-{
+{ cout << __func__ << endl;
mInteractiveDisplayIsEnabled = b;
if (!mInteractiveDisplayIsEnabled) {
RemoveVTKObjects();
} else {
for(unsigned int i=0; i<mImageContour.size(); i++) {
mImageContour[i]->ShowActors();
+ mImageContour[i]->Print(cout);
if (mRadioButtonLowerThan->isChecked())
mImageContourLower[i]->ShowActors();
}
//------------------------------------------------------------------------------
void vvToolBinarize::RemoveVTKObjects()
-{
+{ cout << __func__ << endl;
for(unsigned int i=0; i<mImageContour.size(); i++) {
mImageContour[i]->HideActors();
mImageContourLower[i]->HideActors();
//------------------------------------------------------------------------------
bool vvToolBinarize::close()
-{
+{ cout << __func__ << endl;
// RemoveVTKObjects();
return vvToolWidgetBase::close();
}
//------------------------------------------------------------------------------
-void vvToolBinarize::closeEvent(QCloseEvent *event) {
+void vvToolBinarize::closeEvent(QCloseEvent *event)
+{ cout << __func__ << endl;
RemoveVTKObjects();
event->accept();
}
//------------------------------------------------------------------------------
void vvToolBinarize::reject()
-{
+{ cout << __func__ << endl;
// DD("vvToolBinarize::reject");
RemoveVTKObjects();
return vvToolWidgetBase::reject();
//------------------------------------------------------------------------------
void vvToolBinarize::enableLowerThan(bool b)
-{
+{ cout << __func__ << endl;
if (!b) {
mThresholdSlider1->resetMaximum();
for(unsigned int i=0; i<mImageContour.size(); i++) {
//------------------------------------------------------------------------------
void vvToolBinarize::useFGBGtoggled(bool)
-{
+{ cout << __func__ << endl;
if (!mCheckBoxUseBG->isChecked() && !mCheckBoxUseFG->isChecked())
mCheckBoxUseBG->toggle();
}
// DD(m.size());
// }
void vvToolBinarize::InputIsSelected(vvSlicerManager * m)
-{
+{ cout << __func__ << endl;
mCurrentSlicerManager = m;
// Specific for this gui
mImageContourLower[i]->SetSlicer(mCurrentSlicerManager->GetSlicer(i));
mImageContourLower[i]->SetColor(0.0, 0.0, 1.0);
mImageContourLower[i]->SetDepth(100); // to be in front of (whe used with ROI tool)
+ mImageContour[i]->Print(cout);
}
valueChangedT1(mThresholdSlider1->GetValue());
connect(mCurrentSlicerManager,SIGNAL(UpdateOrientation(int,int)),this,SLOT(UpdateOrientation(int, int)));
// connect(mCurrentSlicerManager, SIGNAL(LeftButtonReleaseSignal(int)), SLOT(LeftButtonReleaseEvent(int)));
-
+ cout << mInteractiveDisplayIsEnabled << endl;
InteractiveDisplayToggled(mInteractiveDisplayIsEnabled);
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolBinarize::UpdateOrientation(int slicer,int orientation)
-{
+{ cout << __func__ << endl;
Update(slicer);
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolBinarize::UpdateSlice(int slicer,int slices)
-{
+{ cout << __func__ << endl;
Update(slicer);
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolBinarize::Update(int slicer)
-{
+{ cout << __func__ << endl;
if (!mInteractiveDisplayIsEnabled) return;
if (!mCurrentSlicerManager) close();
mImageContour[slicer]->Update(mThresholdSlider1->GetValue());
//------------------------------------------------------------------------------
void vvToolBinarize::GetArgsInfoFromGUI()
-{
+{ cout << __func__ << endl;
/* //KEEP THIS FOR READING GGO FROM FILE
int argc=1;
//------------------------------------------------------------------------------
void vvToolBinarize::apply()
-{
+{ cout << __func__ << endl;
if (!mCurrentSlicerManager) close();
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
GetArgsInfoFromGUI();
//------------------------------------------------------------------------------
void vvToolBinarize::valueChangedT2(double v)
-{
+{ cout << __func__ << endl;
// DD("valueChangedT2");
if (mRadioButtonLowerThan->isChecked()) {
mThresholdSlider1->SetMaximum(v);
//------------------------------------------------------------------------------
void vvToolBinarize::valueChangedT1(double v)
-{
+{ cout << __func__ << endl;
// DD("valueChangedT1");
if (!mCurrentSlicerManager) close();
mThresholdSlider2->SetMinimum(v);