void vvMainWindow::UpdateRenderWindows()
{
for (unsigned int i = 0; i < mSlicerManagers.size(); i++) {
- mSlicerManagers[i]->GetSlicer(0)->UpdateLandmarks();
- mSlicerManagers[i]->GetSlicer(1)->UpdateLandmarks();
- mSlicerManagers[i]->GetSlicer(2)->UpdateLandmarks();
- mSlicerManagers[i]->GetSlicer(3)->UpdateLandmarks();
+ for (unsigned int j = 0; j < 4; ++j) {
+ mSlicerManagers[i]->GetSlicer(j)->RemoveLandmarks();
+ mSlicerManagers[i]->GetSlicer(j)->DisplayLandmarks();
+ }
}
if (NOViewWidget->GetRenderWindow()) NOViewWidget->GetRenderWindow()->Render();
if (NEViewWidget->GetRenderWindow()) NEViewWidget->GetRenderWindow()->Render();
}
else if(mVF)
mVFActor->SetVisibility(false);
+
+
+ double boundsT [6];
+ for(unsigned int i=0; i<6; i++)
+ boundsT[i] = ImageActor->GetBounds()[i];
+ boundsT[ this->SliceOrientation*2 ] = ImageActor->GetBounds()[ this->SliceOrientation*2 ]-fabs(this->GetInput()->GetSpacing()[this->SliceOrientation]);
+ boundsT[ this->SliceOrientation*2+1 ] = ImageActor->GetBounds()[ this->SliceOrientation*2+1 ]+fabs(this->GetInput()->GetSpacing()[this->SliceOrientation]);
+
// Landmarks actor
if (mLandActor) {
if (mClipBox) {
- double bounds [6];
- for(unsigned int i=0; i<6; i++)
- bounds[i] = ImageActor->GetBounds()[i];
- bounds[ this->SliceOrientation*2 ] = ImageActor->GetBounds()[ this->SliceOrientation*2 ]-fabs(this->GetInput()->GetSpacing()[this->SliceOrientation]);
- bounds[ this->SliceOrientation*2+1 ] = ImageActor->GetBounds()[ this->SliceOrientation*2+1 ]+fabs(this->GetInput()->GetSpacing()[this->SliceOrientation]);
- mClipBox->SetBounds(bounds);
- UpdateLandmarks();
+ RemoveLandmarks();
}
position[this->SliceOrientation] = offset;
cam->SetClippingRange(range - sumSpacing, range + sumSpacing);
}
}
+
+ if (mLandActor) {
+ if (mClipBox) {
+ DisplayLandmarks();
+ }
+ }
}
emit UpdateDisplayExtentEnd(mSlicerNumber);
}
#endif
mFusionMapper->Update();
}
- if (mLandMapper)
- UpdateLandmarks();
+ if (mLandMapper) {
+ RemoveLandmarks();
+ DisplayLandmarks();
+ }
this->GetRenderWindow()->Render();
}
//----------------------------------------------------------------------------
-void vvSlicer::UpdateLandmarks()
+void vvSlicer::RemoveLandmarks()
{
vtkPolyData *pd = static_cast<vtkPolyData*>(mLandClipper->GetInput());
if (pd->GetPoints()) {
- //mLandGlyph->SetRange(0,1);
- //mLandGlyph->Modified();
- //mLandGlyph->Update();
- mClipBox->Modified();
- mLandClipper->Update();
- mLandMapper->Update();
- //Let's add the captions
//First remove all captions:
for(unsigned int i=0;i<mLandLabelActors.size();i++) {
this->Renderer->RemoveActor2D(mLandLabelActors[i]);
//allActors2D->Remove (mLandLabelActors[i]);
}
mLandLabelActors.clear();
+ }
+}
+//----------------------------------------------------------------------------
+
+
+//----------------------------------------------------------------------------
+void vvSlicer::DisplayLandmarks()
+{
+
+ double bounds [6];
+ for(unsigned int i=0; i<6; i++)
+ bounds[i] = ImageActor->GetBounds()[i];
+ bounds[ this->SliceOrientation*2 ] = ImageActor->GetBounds()[ this->SliceOrientation*2 ]-fabs(this->GetInput()->GetSpacing()[this->SliceOrientation]);
+ bounds[ this->SliceOrientation*2+1 ] = ImageActor->GetBounds()[ this->SliceOrientation*2+1 ]+fabs(this->GetInput()->GetSpacing()[this->SliceOrientation]);
+ mClipBox->SetBounds(bounds);
+
+
+ vtkPolyData *pd = static_cast<vtkPolyData*>(mLandClipper->GetInput());
+ if (pd->GetPoints()) {
+ //mLandGlyph->SetRange(0,1);
+ //mLandGlyph->Modified();
+ //mLandGlyph->Update();
+
+ mClipBox->Modified();
+ mLandClipper->Update();
+ mLandMapper->Update();
//Next add the captions to the displayed points
for (vtkIdType id=0; id<mLandClipper->GetOutput()->GetNumberOfPoints(); id++) {
double *position = mLandClipper->GetOutput()->GetPoint(id);
void GetExtremasAroundMousePointer(double & min, double & max, vtkImageData *image, vtkTransform *transform);
- void UpdateLandmarks();
+ void RemoveLandmarks();
+ void DisplayLandmarks();
void ForceUpdateDisplayExtent();
int* GetDisplayExtent();
if (newLandmark) {
this->SM->AddNewLandmark(xWorld,yWorld,zWorld,
this->SM->GetSlicer(VisibleInWindow)->GetTSlice());
- this->SM->GetSlicer(VisibleInWindow)->UpdateLandmarks();
+ this->SM->GetSlicer(VisibleInWindow)->RemoveLandmarks();
+ //this->SM->GetSlicer(VisibleInWindow)->DisplayLandmarks();
this->SM->Render();
}
if (event == vtkCommand::PickEvent || event == vtkCommand::StartPickEvent) {
#include <QFileDialog>
#include <QShortcut>
+#include <algorithm>
+
// vv
#include "vvToolProfile.h"
#include "vvProgressDialog.h"
{
QString position = "";
+ if(mCurrentSlicerManager) {
+ cout << mCurrentSlicerManager->GetSelectedSlicer() << endl;
if (mPoint1Selected) {
ProfileWidget->hide();
vtkSmartPointer<vtkChartXY> chart = vtkSmartPointer<vtkChartXY>::New();
}
mPoint1Selected = false;
- if(mCurrentSlicerManager) {
+
if(mCurrentSlicerManager->GetSelectedSlicer() != -1) {
double *pos;
- int *index;
pos = new double [4];
pos[0] = pos[1] = pos[2] = pos[3] = 0;
- index = new int [mCurrentSlicerManager->GetImage()->GetNumberOfDimensions()];
int i(0);
while (i<mCurrentSlicerManager->GetImage()->GetNumberOfDimensions() && i<3) {
pos[i] = mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetCursorPosition()[i];
- index[i] = (int) (pos[i] - mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetOrigin()[i])/mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetSpacing()[i];
position += QString::number(pos[i],'f',1) + " ";
- mPoint1[i] = index[i];
+ mPoint1[i] = round((pos[i] - mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetOrigin()[i])/mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetSpacing()[i]);
++i;
}
if (mCurrentSlicerManager->GetImage()->GetNumberOfDimensions() == 4) {
pos[3] = mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetTSlice();
- index[3] = (int)pos[3];
position += QString::number(pos[3],'f',1) + " ";
- mPoint1[3] = index[3];
+ mPoint1[3] = round(pos[3]);
}
mPoint1Selected = true;
mCurrentSlicerManager->AddLandmarkProfile(pos[0], pos[1], pos[2], pos[3]);
{
QString position = "";
+ if(mCurrentSlicerManager) {
if (mPoint2Selected) {
ProfileWidget->hide();
vtkSmartPointer<vtkChartXY> chart = vtkSmartPointer<vtkChartXY>::New();
}
mPoint2Selected = false;
- if(mCurrentSlicerManager) {
if(mCurrentSlicerManager->GetSelectedSlicer() != -1) {
double *pos;
- int *index;
pos = new double [4];
pos[0] = pos[1] = pos[2] = pos[3] = 0;;
- index = new int [mCurrentSlicerManager->GetImage()->GetNumberOfDimensions()];
int i(0);
while (i<mCurrentSlicerManager->GetImage()->GetNumberOfDimensions() &&i<3) {
pos[i] = mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetCursorPosition()[i];
- index[i] = (int) (pos[i] - mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetOrigin()[i])/mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetSpacing()[i];
position += QString::number(pos[i],'f',1) + " ";
- mPoint2[i] = index[i];
+ mPoint2[i] = round((pos[i] - mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetOrigin()[i])/mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetInput()->GetSpacing()[i]);
++i;
}
if (mCurrentSlicerManager->GetImage()->GetNumberOfDimensions() == 4) {
pos[3] = mCurrentSlicerManager->GetSlicer(mCurrentSlicerManager->GetSelectedSlicer())->GetTSlice();
- index[3] = (int)pos[3];
position += QString::number(pos[3],'f',1) + " ";
- mPoint2[3] = index[3];
+ mPoint2[3] = round(pos[3]);
}
mPoint2Selected = true;
mCurrentSlicerManager->AddLandmarkProfile(pos[0], pos[1], pos[2], pos[3]);
void vvToolProfile::computeProfile()
{
if (!mCurrentSlicerManager) close();
-
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
GetArgsInfoFromGUI();
ProfileWidget->hide();
-
+
// Main filter
mFilter->SetInputVVImage(mCurrentImage);
mFilter->SetArgsInfo(mArgsInfo);
mFilter->Update();
- //mImageLine = mFilter->GetOutputVVImage();
vtkSmartPointer<vtkTable> table = vtkSmartPointer<vtkTable>::New();
vtkSmartPointer<vtkFloatArray> arrX = vtkSmartPointer<vtkFloatArray>::New();
mArgsInfo.input_arg = new char;
mArgsInfo.output_arg = new char;
+
+
}
//------------------------------------------------------------------------------
if(mCurrentSlicerManager) {
if(mCurrentSlicerManager->GetSelectedSlicer() != -1) {
+ if (std::min(mPoint1[mCurrentSlicerManager->GetSlicer(slicer)->GetOrientation()],mPoint2[mCurrentSlicerManager->GetSlicer(slicer)->GetOrientation()]) <= mCurrentSlicerManager->GetSlicer(slicer)->GetSlice() && std::max(mPoint1[mCurrentSlicerManager->GetSlicer(slicer)->GetOrientation()],mPoint2[mCurrentSlicerManager->GetSlicer(slicer)->GetOrientation()]) >= mCurrentSlicerManager->GetSlicer(slicer)->GetSlice()) {
vtkSmartPointer<vtkBox> clippingBox = vtkSmartPointer<vtkBox>::New();
double extent[6];
for (int j=0; j<6; ++j) {
mLineActors[slicer]->GetProperty()->SetOpacity(0.995);
mCurrentSlicerManager->GetSlicer(slicer)->GetRenderer()->AddActor(mLineActors[slicer]);
+ }
}
}
}