#include <vtkCutter.h>
#include <vtkAssignAttribute.h>
#include <vtkImageAccumulate.h>
+#include <vtkImageReslice.h>
vtkCxxRevisionMacro(vvSlicer, "DummyRevision");
vtkStandardNewMacro(vvSlicer);
mSubSampling = 5;
mScale = 1;
mVFLog = 0;
+ mVFWidth = 1;
std::string text = "F1 = sagital; F2 = coronal; F3 = axial\n";
text += "F5 = horizontal flip; F6 = vertical flip\n\n";
this->WindowLevel->Delete();
this->WindowLevel = vvImageMapToWLColors::New();
this->InstallPipeline();
+
}
//------------------------------------------------------------------------------
{
mImage = image;
this->Superclass::SetInput(image->GetVTKImages()[0]);
+
+ // Prevent crash when reload -> change slice if outside extent
+ int extent[6];
+ this->GetInput()->GetWholeExtent(extent);
+ if (SliceOrientation == 0) {
+ if (Slice >= extent[1]) {
+ Slice = (extent[1]-extent[0])/2.0;
+ }
+ }
+ if (SliceOrientation == 1) {
+ if (Slice >= extent[3]) {
+ Slice = (extent[3]-extent[2])/2.0;
+ }
+ }
+ if (SliceOrientation == 2) {
+ if (Slice >= extent[5]) {
+ Slice = (extent[5]-extent[4])/2.0;
+ }
+ }
+
this->UpdateDisplayExtent();
mCurrentTSlice = 0;
ca->SetText(0,mFileName.c_str());
mVFActor = vtkActor::New();
mVFActor->SetMapper(mVFMapper);
mVFActor->SetPickable(0);
+ mVFActor->GetProperty()->SetLineWidth(mVFWidth);
this->UpdateDisplayExtent();
this->GetRenderer()->AddActor(mVFActor);
}
//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+void vvSlicer::SetVFWidth(int width)
+{
+ mVFWidth = width;
+ if (mVFActor)
+ mVFActor->GetProperty()->SetLineWidth(mVFWidth);
+ UpdateDisplayExtent();
+ Render();
+}
+//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvSlicer::SetVFLog(int log)
pixel2 << (int)Y;
pixel3 << (int)Z;
temps << mCurrentTSlice;
- double value = this->GetInput()->GetScalarComponentAsDouble(
- (int)X,
- (int)Y,
- (int)Z,0);
+ double value = this->GetInput()->GetScalarComponentAsDouble(lrint(X),
+ lrint(Y),
+ lrint(Z),0);
std::stringstream val;
val << value;
SetContourSlice();
this->Modified();
this->UpdateDisplayExtent();
- this->Render();
+
+ // DD("SetSlice de slicer = Render");
+
+ // Seems to work without this line
+ // this->Render();
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
+
+
+
+
+