<rect>
<x>0</x>
<y>0</y>
- <width>325</width>
+ <width>382</width>
<height>214</height>
</rect>
</property>
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0" colspan="-1">
- <widget class="QLabel" name="nameLabel">
- <property name="text">
- <string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">CurrentImage :</span></p></body></html></string>
- </property>
- </widget>
- </item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="text">
</property>
</widget>
</item>
+ <item row="0" column="0" colspan="5">
+ <widget class="QLabel" name="nameLabel">
+ <property name="text">
+ <string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">CurrentImage :</span></p></body></html></string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="3" colspan="2">
+ <widget class="QPushButton" name="updateTransformButton">
+ <property name="text">
+ <string>Update Coords.</string>
+ </property>
+ <property name="icon">
+ <iconset resource="../vvIcons.qrc">
+ <normaloff>:/common/icons/rotateright.png</normaloff>:/common/icons/rotateright.png</iconset>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<resources>
vvLandmarks::vvLandmarks(int size)
{
mLandmarks.resize(size);
+ mLandmarksInitial.resize(size);
mFilenames.resize(0);
mTime = 0;
for (int i = 0; i < size; i++) {
mLandmarks[i].resize(0);
+ mLandmarksInitial[i].resize(0);
vtkPoints *points = vtkPoints::New();
mPoints.push_back(points);
mIds.push_back(vtkFloatArray::New());
point.coordinates[3] = t;
point.pixel_value=value;
mLandmarks[mTime].push_back(point);
+ mLandmarksInitial[mTime].push_back(point);
idPoint = mPoints[int(t)]->InsertNextPoint(x,y,z);
std::string str_vtkIdType; // string which will contain the result
}
//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+void vvLandmarks::TransformUpdate(vtkAbstractTransform* transform)
+{
+ //For all Time, For all landmarks, I apply the transform
+ for(int time=0; time<mLandmarks.size(); ++time)
+ {
+ for(int landmark=0; landmark<mLandmarks[time].size(); ++landmark)
+ {
+ double ptBeforeTransform[3], ptAfterTransform[3];
+ ptBeforeTransform[0]= mLandmarksInitial[time][landmark].coordinates[0];
+ ptBeforeTransform[1]= mLandmarksInitial[time][landmark].coordinates[1];
+ ptBeforeTransform[2]= mLandmarksInitial[time][landmark].coordinates[2];
+ transform->TransformPoint(ptBeforeTransform, ptAfterTransform);
+
+ mLandmarks[time][landmark].coordinates[0]= ptAfterTransform[0];
+ mLandmarks[time][landmark].coordinates[1]= ptAfterTransform[1];
+ mLandmarks[time][landmark].coordinates[2]= ptAfterTransform[2];
+ }
+ }
+}
+//--------------------------------------------------------------------
//--------------------------------------------------------------------
void vvLandmarks::RemoveLastLandmark()
mPoints[mTime]->SetNumberOfPoints(mPoints[mTime]->GetNumberOfPoints()-1);
// mText.pop_back();
mLandmarks[mTime].pop_back();
+ mLandmarksInitial[mTime].pop_back();
mIds[mTime]->RemoveLastTuple();
mLabels[mTime]->SetNumberOfValues(mLabels[mTime]->GetNumberOfValues()-1);
mLabels[mTime]->Modified();
mPolyData->Modified();
mLandmarks[t].erase(mLandmarks[t].begin() + index);
+ mLandmarksInitial[t].erase(mLandmarksInitial[t].begin() + index);
mIds[t]->RemoveLastTuple();
}
//--------------------------------------------------------------------
mPolyData->Modified();
mLandmarks[t].erase(mLandmarks[t].begin() + index);
+ mLandmarksInitial[t].erase(mLandmarksInitial[t].begin() + index);
mIds[t]->RemoveLastTuple();
}
//--------------------------------------------------------------------
{
for (unsigned int i = 0; i < mLandmarks.size(); i++) {
mLandmarks[i].clear();
+ mLandmarksInitial[i].clear();
mPoints[i]->SetNumberOfPoints(0);
mLabels[i]->SetNumberOfValues(0);
mIds[i]->SetNumberOfValues(0);
void vvLandmarks::ChangeComments(int index, std::string comments)
{
mLandmarks[mTime][index].comments = comments;
+ mLandmarksInitial[mTime][index].comments = comments;
}
//--------------------------------------------------------------------
mFilenames = filenames;
for (unsigned int i = 0; i < mPoints.size(); i++) {
mLandmarks[i].clear();
+ mLandmarksInitial[i].clear();
mPoints[i]->SetNumberOfPoints(0);
}
}
// DD(point.comments);
mLandmarks[int(point.coordinates[3])].push_back(point);
+ mLandmarksInitial[int(point.coordinates[3])].push_back(point);
mIds[int(point.coordinates[3])]->InsertNextTuple1(0.55);
idPoint = mPoints[int(point.coordinates[3])]->InsertNextPoint(
point.coordinates[0],point.coordinates[1],point.coordinates[2]);
for (unsigned int i = 0; i < mPoints.size(); i++) {
mPoints[i]->SetNumberOfPoints(0);
mLandmarks[i].clear();
+ mLandmarksInitial[i].clear();
}
int err = 0;
// DD(point.comments);
mLandmarks[int(point.coordinates[3])].push_back(point);
+ mLandmarksInitial[int(point.coordinates[3])].push_back(point);
mIds[int(point.coordinates[3])]->InsertNextTuple1(0.55);
idPoint = mPoints[int(point.coordinates[3])]->InsertNextPoint(
point.coordinates[0],point.coordinates[1],point.coordinates[2]);
#include "vtkPoints.h"
#include "vvLandmarksGlyph.h"
#include "vtkStringArray.h"
+#include <vtkAbstractTransform.h>
//typedef
struct vvLandmark {
void SaveFile(std::string filename);
void AddLandmark(float x,float y,float z,float t,double value);
+ void TransformUpdate(vtkAbstractTransform* transform);
void RemoveLastLandmark();
void RemoveLandmarkWithLabel(vtkStdString, int);
void RemoveLandmark(int index);
typedef std::vector<vvLandmark> LandmarkContainerType;
std::vector<LandmarkContainerType> mLandmarks;
+ std::vector<LandmarkContainerType> mLandmarksInitial;
vtkPolyData *mPolyData;
std::vector<vtkPoints*> mPoints;
tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
loadButton->setEnabled(0);
saveButton->setEnabled(0);
+ updateTransformButton->setEnabled(0);
removeButton->setEnabled(0);
connect(loadButton, SIGNAL(clicked()),this,SLOT(Load()));
connect(saveButton, SIGNAL(clicked()),this,SLOT(Save()));
+ connect(updateTransformButton, SIGNAL(clicked()),this,SLOT(UpdateTransform()));
connect(removeButton, SIGNAL(clicked()),this,SLOT(RemoveSelectedPoints()));
connect(removeAllButton, SIGNAL(clicked()),this,SLOT(RemoveAllPoints()));
connect(tableWidget,SIGNAL(cellChanged(int,int)),this,SLOT(CommentsChanged(int,int)));
}
}
+void vvLandmarksPanel::UpdateTransform()
+{
+ emit UpdateLandmarkTransform();
+ SetCurrentLandmarks(mCurrentLandmarks,mCurrentLandmarks->GetTime());
+}
+
void vvLandmarksPanel::SelectPoint()
{
if (tableWidget->rowCount() > 0) {
return;
loadButton->setEnabled(1);
saveButton->setEnabled(1);
+ updateTransformButton->setEnabled(1);
removeButton->setEnabled(1);
mCurrentLandmarks = lm;
tableWidget->clearContents();
void Load();
bool LoadFromFile(std::vector<std::string> file);
void Save();
+ void UpdateTransform();
void RemoveSelectedPoints();
void RemoveAllPoints();
void AddPoint();
signals:
void UpdateRenderWindows();
void SelectedPointChanged();
+ void UpdateLandmarkTransform();
private:
void AddPoint(int);
connect(mSlicerManagers.back(), SIGNAL(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)),
this,SLOT(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)));
connect(mSlicerManagers.back(),SIGNAL(LandmarkAdded()),landmarksPanel,SLOT(AddPoint()));
+ connect(landmarksPanel,SIGNAL(UpdateLandmarkTransform()), mSlicerManagers.back(), SLOT(UpdateLandmark()));
InitSlicers();
numberofsuccesulreads++;
}
connect(mSlicerManagers.back(), SIGNAL(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)),
this,SLOT(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)));
connect(mSlicerManagers.back(), SIGNAL(LandmarkAdded()),landmarksPanel,SLOT(AddPoint()));
+ connect(landmarksPanel,SIGNAL(UpdateLandmarkTransform()), mSlicerManagers.back(), SLOT(UpdateLandmark()));
}
//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+void vvSlicerManager::UpdateLandmark()
+{
+ this->GetLandmarks()->TransformUpdate(mSlicers[mSelectedSlicer]->GetConcatenatedTransform()->GetInverse());
+}
+//----------------------------------------------------------------------------
+
//----------------------------------------------------------------------------
void vvSlicerManager::PrevImage(int slicer)
{
public slots:
void AddLandmark(float x,float y,float z,float t);
+ void UpdateLandmark();
signals :
void callAddLandmark(float x,float y,float z,float t);