Fix a ImageStack ijk pick bug.
This commit is contained in:
@@ -99,11 +99,8 @@ void ActorDraggableInteractorStyle::ColorMapping()
|
||||
|
||||
vtkRenderWindowInteractor* rwi = this->Interactor;
|
||||
this->ScalarCurrentPosition[1] = rwi->GetEventPosition()[1];
|
||||
|
||||
//pos[0] = (this->ScalarCurrentPosition[0] - this->ScalarStartPosition[0]);
|
||||
double total = 0.01 * ((this->ScalarCurrentPosition[1] - this->ScalarStartPosition[1]) / scalarSensitivity);
|
||||
double left = total - ConsumedOpacity;
|
||||
//printf("ColorMapping:%d,%d,%.2f \r\n", ScalarCurrentPosition[1], ScalarStartPosition[1],left);
|
||||
if (abs(left) >= 0.01) {
|
||||
OpacityTrigger = true;
|
||||
this->InvokeEvent(ScalarOpacityEvent, &left);
|
||||
@@ -114,7 +111,7 @@ void ActorDraggableInteractorStyle::ColorMapping()
|
||||
|
||||
void ActorDraggableInteractorStyle::EndColorMapping()
|
||||
{
|
||||
if (false == OpacityTrigger)
|
||||
if (!OpacityTrigger)
|
||||
{
|
||||
this->InvokeEvent(ScalarShiftEvent, nullptr);
|
||||
}
|
||||
@@ -165,6 +162,11 @@ void ActorDraggableInteractorStyle::NoneStatePick() {
|
||||
p->AddPickList(obj);
|
||||
p->Pick(pos[0], pos[1], 0.0, this->CurrentRenderer);
|
||||
int* ijk = p->GetPointIJK();
|
||||
//TODO: sometimes ijk will have value less than 0;need to fid out the reason
|
||||
//Firstly: simple fix by set value to 0
|
||||
for (int i = 0; i < 3 ; i++){
|
||||
ijk[i] = ijk[i]<0?0:ijk[i];
|
||||
}
|
||||
std::string message = "X:";
|
||||
message += vtkVariant(ijk[0]).ToString();
|
||||
message += " Y:";
|
||||
|
||||
Reference in New Issue
Block a user