vtkCxxRevisionMacro(vvSlicer, "DummyRevision");
vtkStandardNewMacro(vvSlicer);
+//------------------------------------------------------------------------------
vvSlicer::vvSlicer()
{
mImage = NULL;
this->WindowLevel = vvImageMapToWLColors::New();
this->InstallPipeline();
}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
vtkImageMapToWindowLevelColors* vvSlicer::GetOverlayMapper() {
return mOverlayMapper.GetPointer();
}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
vtkImageActor* vvSlicer::GetOverlayActor() {
return mOverlayActor.GetPointer();
}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
vtkImageMapToWindowLevelColors* vvSlicer::GetFusionMapper() {
return mFusionMapper.GetPointer();
}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
vtkImageActor* vvSlicer::GetFusionActor() {
return mFusionActor.GetPointer();
}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
vtkActor* vvSlicer::GetVFActor() {
return mVFActor.GetPointer();
}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
vtkCornerAnnotation* vvSlicer::GetAnnotation() {
return ca.GetPointer();
}
+//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvSlicer::EnableReducedExtent(bool b) {
SetContourSlice();
}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
void vvSlicer::ToggleContourSuperposition()
{
for (std::vector<vvMeshActor*>::iterator i=mSurfaceCutActors.begin();
i!=mSurfaceCutActors.end();i++)
(*i)->ToggleSuperposition();
}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
void vvSlicer::SetCursorColor(int r,int g, int b)
{
pdmA->GetProperty()->SetColor(r,g,b);
}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
void vvSlicer::SetCursorVisibility(bool s)
{
pdmA->SetVisibility(s);
}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
bool vvSlicer::GetCursorVisibility()
{
return pdmA->GetVisibility();
}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
vvSlicer::~vvSlicer()
{
for (std::vector<vvMeshActor*>::iterator i=mSurfaceCutActors.begin();
i!=mSurfaceCutActors.end();i++)
delete (*i);
}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
void vvSlicer::SetCurrentPosition(double x, double y, double z, int t)
{
mCurrent[0] = x;
mCurrent[2] = z;
mCurrentTSlice = t;
}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
void vvSlicer::SetImage(vvImage::Pointer image)
{
if (image->GetVTKImages().size())
ca->SetText(0,mFileName.c_str());
}
}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
void vvSlicer::SetOverlay(vvImage::Pointer overlay)
{
if (overlay->GetVTKImages().size())
SetTSlice(mCurrentTSlice);
}
}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
void vvSlicer::SetFusion(vvImage::Pointer fusion)
{
if (fusion->GetVTKImages().size())
SetTSlice(mCurrentTSlice);
}
}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
void vvSlicer::SetActorVisibility(const std::string& actor_type, int overlay_index ,bool vis)
{
if (actor_type == "vector")
this->mSurfaceCutActors[overlay_index]->GetActor()->SetVisibility(vis);
UpdateDisplayExtent();
}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
void vvSlicer::SetVF(vvImage::Pointer vf)
{
if (vf->GetVTKImages().size())
SetTSlice(mCurrentTSlice);
}
}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
void vvSlicer::SetLandmarks(vvLandmarks* landmarks)
{
mLandmarks = landmarks;
this->GetRenderer()->AddActor(mLandActor);
}
}
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
//FIXME: this function leaks memory, we should fix it someday :)
void vvSlicer::RemoveActor(const std::string& actor_type, int overlay_index)
{
mSurfaceCutActors.erase(mSurfaceCutActors.begin()+overlay_index);
}
}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
void vvSlicer::SetVFSubSampling(int sub)
{
if (mVOIFilter)
UpdateDisplayExtent();
Render();
}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
void vvSlicer::SetVFScale(int scale)
{
mScale = scale;
UpdateDisplayExtent();
Render();
}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
void vvSlicer::SetVFLog(int log)
{
mVFLog = log;
UpdateDisplayExtent();
Render();
}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
void vvSlicer::SetTSlice(int t)
{
if (t < 0)
(*i)->SetTimeSlice(mCurrentTSlice);
UpdateDisplayExtent();
}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
int vvSlicer::GetTSlice()
{
return mCurrentTSlice;
}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
void vvSlicer::SetSliceOrientation(int orientation)
{
//if 2D image, force to watch in Axial View
}
else w_ext = input->GetWholeExtent();
- DD(w_ext[0]);
- DD(w_ext[1]);
- DD(w_ext[2]);
-
switch (this->SliceOrientation)
{
case vtkImageViewer2::SLICE_ORIENTATION_XY:
}
}
}
+//----------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
void vvSlicer::ComputeVFDisplayedExtent(int x1,int x2,int y1,int y2,int z1,int z2,int vfExtent[6])
{
vtkImageData* image=this->GetInput();
ClipDisplayedExtent(vfExtent,mVOIFilter->GetInput()->GetWholeExtent());
}
+//----------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
void vvSlicer::ComputeOverlayDisplayedExtent(int x1,int x2,int y1,int y2,int z1,int z2,int overExtent[6])
{
vtkImageData* image=this->GetInput();
mOverlay->GetSpacing()[2];
ClipDisplayedExtent(overExtent, mOverlayMapper->GetInput()->GetWholeExtent());
}
+//----------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
void vvSlicer::ComputeFusionDisplayedExtent(int x1,int x2,int y1,int y2,int z1,int z2,int fusExtent[6])
{
vtkImageData* image=this->GetInput();
mFusion->GetSpacing()[2];
ClipDisplayedExtent(fusExtent, mFusionMapper->GetInput()->GetWholeExtent());
}
+//----------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
void vvSlicer::ClipDisplayedExtent(int extent[6], int refExtent[6])
{
bool out = false;
extent[i+1] = refExtent[i];
}
}
+//----------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
void vvSlicer::UpdateOrientation()
{
// Set the camera position
}
}
}
+//----------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
void vvSlicer::SetOpacity(double s)
{
this->GetImageActor()->SetOpacity(s);
}
+//----------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
void vvSlicer::SetRenderWindow(int orientation, vtkRenderWindow * rw)
{
this->Superclass::SetRenderWindow(rw);
SetSliceOrientation(2-(orientation%3));
ResetCamera();
}
+//----------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
void vvSlicer::ResetCamera()
{
if (this->GetInput())
this->GetRenderer()->GetActiveCamera()->SetParallelScale(bmax/2);
}
}
+//----------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
void vvSlicer::SetDisplayMode(bool i)
{
this->GetImageActor()->SetVisibility(i);
std::stringstream val;
val << value;
worldPos += "data value : " + val.str();
- worldPos += "\n mm : " + world1.str() + " " + world2.str() + " " + world3.str() + " " + temps.str();
- worldPos += "\n pixel : " + pixel1.str() + " " + pixel2.str() + " " + pixel3.str() + " " + temps.str();
+ worldPos += "\n mm : " + world1.str() + " " + world2.str() + " " +
+ world3.str() + " " + temps.str();
+ worldPos += "\n pixel : " + pixel1.str() + " " + pixel2.str() + " " +
+ pixel3.str() + " " + temps.str();
}
ca->SetText(1,worldPos.c_str());
}
}
//----------------------------------------------------------------------------
+
//----------------------------------------------------------------------------
void vvSlicer::UpdateLandmarks()
{
//----------------------------------------------------------------------------
void vvSlicer::SetSlice(int slice)
{
- DD("vvSlicer::SetSlice");
- DD(slice);
int *range = this->GetSliceRange();
- DD(range[0]);
- DD(range[1]);
if (range)
{
if (slice < range[0])