z >= mSlicers[slicer]->GetInput()->GetWholeExtent()[4]-0.5 &&
z <= mSlicers[slicer]->GetInput()->GetWholeExtent()[5]+0.5) {
for (std::list<std::string>::const_iterator i = mLinkedId.begin(); i != mLinkedId.end(); i++) {
- emit UpdateLinkManager(*i, slicer,mSlicers[slicer]->GetCurrentPosition()[0],
- mSlicers[slicer]->GetCurrentPosition()[1],
- mSlicers[slicer]->GetCurrentPosition()[2],mSlicers[slicer]->GetTSlice());
+ emit UpdateLinkManager(*i, slicer, p[0], p[1], p[2], mSlicers[slicer]->GetTSlice());
}
}
}
void vvSlicerManager::UpdateLinkedNavigation(vvSlicer *refSlicer, bool bPropagate)
{
vtkCamera *refCam = refSlicer->GetRenderer()->GetActiveCamera();
- double refPosition[3], refFocal[3];
+
+ double refPosition[3];
refCam->GetPosition(refPosition);
- refCam->GetFocalPoint(refFocal);
-
- refSlicer->GetSlicingTransform()->TransformPoint(refPosition);
- refSlicer->GetSlicingTransform()->TransformPoint(refFocal);
- mSlicers[0]->GetSlicingTransform()->GetInverse()->TransformPoint(refPosition);
- mSlicers[0]->GetSlicingTransform()->GetInverse()->TransformPoint(refFocal);
+ refPosition[refSlicer->GetSliceOrientation()] = refSlicer->GetSlice() *
+ refSlicer->GetInput()->GetSpacing()[refSlicer->GetSliceOrientation()] +
+ refSlicer->GetInput()->GetOrigin()[refSlicer->GetSliceOrientation()];
+
+ refSlicer->GetSlicingTransform()->TransformPoint(refPosition, refPosition);
+ mSlicers[0]->GetSlicingTransform()->GetInverse()->TransformPoint(refPosition, refPosition);
for ( unsigned int i = 0; i < mSlicers.size(); i++) {
vtkCamera *camera = mSlicers[i]->GetRenderer()->GetActiveCamera();
camera->GetPosition(position);
camera->GetFocalPoint(focal);
- if(refSlicer->GetSliceOrientation()==mSlicers[i]->GetSliceOrientation()) {
- for(int i=0; i<3; i++) {
- position[i] = refPosition[i];
- focal[i] = refFocal[i];
- }
- }
-
- if(refSlicer->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_XY) {
- if(mSlicers[i]->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_XZ) {
- position[0] = refPosition[0];
- focal[0] = refFocal[0];
- }
- if(mSlicers[i]->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_YZ) {
- position[1] = refPosition[1];
- focal[1] = refFocal[1];
- }
- }
-
- if(refSlicer->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_XZ) {
- if(mSlicers[i]->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_YZ) {
- position[2] = refPosition[2];
- focal[2] = refFocal[2];
- }
- if(mSlicers[i]->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_XY) {
- position[0] = refPosition[0];
- focal[0] = refFocal[0];
+ for(int j=0; j<3; j++) {
+ if(j!=mSlicers[i]->GetSliceOrientation()) {
+ position[j] = refPosition[j];
+ focal[j] = refPosition[j];
}
}
- if(refSlicer->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_YZ) {
- if(mSlicers[i]->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_XY) {
- position[1] = refPosition[1];
- focal[1] = refFocal[1];
- }
- if(mSlicers[i]->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_XZ) {
- position[2] = refPosition[2];
- focal[2] = refFocal[2];
- }
- }
-DD(camera->GetFocalPoint()[0] << ' ' << camera->GetFocalPoint()[1] << ' ' << camera->GetFocalPoint()[2])
camera->SetFocalPoint(focal);
-DD(camera->GetFocalPoint()[0] << ' ' << camera->GetFocalPoint()[1] << ' ' << camera->GetFocalPoint()[2])
-DD(camera->GetPosition()[0] << ' ' << camera->GetPosition()[1] << ' ' << camera->GetPosition()[2])
camera->SetPosition(position);
-DD(camera->GetPosition()[0] << ' ' << camera->GetPosition()[1] << ' ' << camera->GetPosition()[2])
//Fix for bug #243
mSlicers[i]->ForceUpdateDisplayExtent();
void vvSlicerManager::SetLocalColorWindowing(const int slicer, const bool bCtrlKey)
{
double min, max;
- int t = this->GetTSlice();
if(bCtrlKey && this->mSlicers[slicer]->GetFusion()) {
+ int t = mSlicers[slicer]->GetFusionTSlice();
this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max,
this->mSlicers[slicer]->GetFusion()->GetVTKImages()[t],
- this->mSlicers[slicer]->GetFusion()->GetTransform()[t]);
+ this->mSlicers[slicer]->GetConcatenatedFusionTransform());
this->SetFusionWindow(max-min);
this->SetFusionLevel(0.5*(min+max));
this->SetColorMap(mColorMap);
}
else if(bCtrlKey && this->mSlicers[slicer]->GetOverlay()) {
+ int t = mSlicers[slicer]->GetOverlayTSlice();
this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max,
this->mSlicers[slicer]->GetOverlay()->GetVTKImages()[t],
- this->mSlicers[slicer]->GetOverlay()->GetTransform()[t]);
+ this->mSlicers[slicer]->GetConcatenatedOverlayTransform());
if(this->mSlicers[slicer]->GetLinkOverlayWindowLevel()){
this->SetColorWindow(max-min);
this->SetColorLevel(0.5*(min+max));
}
}
else {
+ int t = this->GetTSlice();
this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max,
this->mSlicers[slicer]->GetImage()->GetVTKImages()[t],
this->mSlicers[slicer]->GetConcatenatedTransform());
double x_index = (x - mSlicers[0]->GetInput()->GetOrigin()[0])/mSlicers[0]->GetInput()->GetSpacing()[0];
double y_index = (y - mSlicers[0]->GetInput()->GetOrigin()[1])/mSlicers[0]->GetInput()->GetSpacing()[1];
double z_index = (z - mSlicers[0]->GetInput()->GetOrigin()[2])/mSlicers[0]->GetInput()->GetSpacing()[2];
- if (x_index >= mSlicers[0]->GetInput()->GetWholeExtent()[0] &&
- x_index <= mSlicers[0]->GetInput()->GetWholeExtent()[1] &&
- y_index >= mSlicers[0]->GetInput()->GetWholeExtent()[2] &&
- y_index <= mSlicers[0]->GetInput()->GetWholeExtent()[3] &&
- z_index >= mSlicers[0]->GetInput()->GetWholeExtent()[4] &&
- z_index <= mSlicers[0]->GetInput()->GetWholeExtent()[5]) {
+ if (x_index >= mSlicers[0]->GetInput()->GetWholeExtent()[0]-0.5 &&
+ x_index <= mSlicers[0]->GetInput()->GetWholeExtent()[1]+0.5 &&
+ y_index >= mSlicers[0]->GetInput()->GetWholeExtent()[2]-0.5 &&
+ y_index <= mSlicers[0]->GetInput()->GetWholeExtent()[3]+0.5 &&
+ z_index >= mSlicers[0]->GetInput()->GetWholeExtent()[4]-0.5 &&
+ z_index <= mSlicers[0]->GetInput()->GetWholeExtent()[5]+0.5) {
double value = this->GetScalarComponentAsDouble(mSlicers[0]->GetInput(), x_index, y_index, z_index);
this->GetLandmarks()->AddLandmark(x,y,z,t,value);
emit LandmarkAdded();