-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvtkUltrasound4DLogic.cxx
105 lines (72 loc) · 3.12 KB
/
vtkUltrasound4DLogic.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*==========================================================================
Portions (c) Copyright 2008 Brigham and Women's Hospital (BWH) All Rights Reserved.
See Doc/copyright/copyright.txt
or http://www.slicer.org/copyright/copyright.txt for details.
Program: 3D Slicer
Module: $HeadURL: $
Date: $Date: $
Version: $Revision: $
==========================================================================*/
#include "vtkObjectFactory.h"
#include "vtkCallbackCommand.h"
#include "vtkSlicerApplication.h"
#include "vtkSlicerApplicationGUI.h"
#include "vtkMRMLScalarVolumeNode.h"
#include "vtkCollection.h"
#include "vtkKWScale.h"
#include "vtkUltrasound4DLogic.h"
vtkCxxRevisionMacro(vtkUltrasound4DLogic, "$Revision: 1.9.12.1 $");
vtkStandardNewMacro(vtkUltrasound4DLogic);
//---------------------------------------------------------------------------
vtkUltrasound4DLogic::vtkUltrasound4DLogic()
{
// Timer Handling
this->DataCallbackCommand = vtkCallbackCommand::New();
this->DataCallbackCommand->SetClientData( reinterpret_cast<void *> (this) );
this->DataCallbackCommand->SetCallback(vtkUltrasound4DLogic::DataCallback);
}
//---------------------------------------------------------------------------
vtkUltrasound4DLogic::~vtkUltrasound4DLogic()
{
if (this->DataCallbackCommand)
{
this->DataCallbackCommand->Delete();
}
}
//---------------------------------------------------------------------------
void vtkUltrasound4DLogic::PrintSelf(ostream& os, vtkIndent indent)
{
this->vtkObject::PrintSelf(os, indent);
os << indent << "vtkUltrasound4DLogic: " << this->GetClassName() << "\n";
}
//---------------------------------------------------------------------------
void vtkUltrasound4DLogic::DataCallback(vtkObject *caller,
unsigned long eid, void *clientData, void *callData)
{
vtkUltrasound4DLogic *self = reinterpret_cast<vtkUltrasound4DLogic *>(clientData);
vtkDebugWithObjectMacro(self, "In vtkUltrasound4DLogic DataCallback");
self->UpdateAll();
}
//---------------------------------------------------------------------------
void vtkUltrasound4DLogic::UpdateAll()
{
}
//---------------------------------------------------------------------------
void vtkUltrasound4DLogic::CopyVolume(vtkMRMLScalarVolumeNode *destinationNode, vtkMRMLScalarVolumeNode *sourceNode)
{
if(sourceNode->GetImageData()->GetActualMemorySize() == destinationNode->GetImageData()->GetActualMemorySize())
{
memcpy(destinationNode->GetImageData()->GetScalarPointer(),
sourceNode->GetImageData()->GetScalarPointer(),
destinationNode->GetImageData()->GetActualMemorySize()*1024);
destinationNode->GetImageData()->Update();
destinationNode->GetImageData()->Modified();
destinationNode->SetAndObserveImageData(destinationNode->GetImageData());
destinationNode->Modified();
}
}
//---------------------------------------------------------------------------
void vtkUltrasound4DLogic::PlayVolumes(vtkMRMLScalarVolumeNode *destinationNode, vtkCollection *ListOfNodes, vtkKWScale *scale)
{
// TODO: Thread (with Mutex ?)
}