QString inputSizeInBytes;
QString image = DataTree->selectedItems()[0]->data(COLUMN_IMAGE_NAME,Qt::DisplayRole).toString();
- if (mSlicerManagers[index]->GetSlicer(0)->GetImage()->GetVTKImages().size() > 1 || playMode == 1) {
+ int nframes = mSlicerManagers[index]->GetSlicer(0)->GetTMax();
+ if (nframes > 1 || playMode == 1) {
playButton->setEnabled(1);
frameRateLabel->setEnabled(1);
frameRateSpinBox->setEnabled(1);
int tRange[2];
tRange[0] = 0;
tRange[1] = mSlicerManagers[slicer]->GetSlicer(window)->GetTMax();
- int tPosition = mSlicerManagers[slicer]->GetSlicer(window)->GetTSlice();
+ int tPosition = mSlicerManagers[slicer]->GetSlicer(window)->GetMaxCurrentTSlice();
bool showHorizontal = false;
bool showVertical = false;
- if (mSlicerManagers[slicer]->GetSlicer(window)->GetImage()->GetNumberOfDimensions() > 3
- || (mSlicerManagers[slicer]->GetSlicer(window)->GetImage()->GetNumberOfDimensions() > 2
- && mSlicerManagers[slicer]->GetType() != vvImageReader::IMAGEWITHTIME
- && mSlicerManagers[slicer]->GetType() != vvImageReader::MERGEDWITHTIME))
+ if (range[1]>0)
showVertical = true;
- if (mSlicerManagers[slicer]->GetSlicer(window)->GetImage()->GetNumberOfDimensions() > 3
- || mSlicerManagers[slicer]->GetType() == vvImageReader::IMAGEWITHTIME
- || mSlicerManagers[slicer]->GetType() == vvImageReader::MERGEDWITHTIME)
+ if (tRange[1]>0)
showHorizontal = true;
if (showVertical)
qApp->processEvents();
ImageInfoChanged();
QApplication::restoreOverrideCursor();
+
+ // Update the display to update, e.g., the sliders
+ for(int i=0; i<4; i++)
+ DisplaySliders(index, i);
} else {
QApplication::restoreOverrideCursor();
QString error = "Cannot import the new image.\n";
vidwriter->SetInput(image);
vidwriter->SetFileName(fileName.toStdString().c_str());
vidwriter->Start();
- vvImage * vvImg = mSlicerManagers[smIndex]->GetImage();
- int nSlice = vvImg->GetVTKImages().size();
- for(int i=0; i<nSlice; i++) {
+ int nSlice = mSlicerManagers[smIndex]->GetSlicer(0)->GetTMax();
+ for(int i=0; i<=nSlice; i++) {
mSlicerManagers[smIndex]->SetNextTSlice(0);
vtkSmartPointer<vtkWindowToImageFilter> w2i = vtkSmartPointer<vtkWindowToImageFilter>::New();
w2i->SetInput(widget->GetRenderWindow());
int image_number=DataTree->topLevelItemCount();
bool has_temporal;
for (int i=0; i<image_number; i++)
- if (mSlicerManagers[i]->GetImage()->GetVTKImages().size() > 1) {
+ if (mSlicerManagers[i]->GetSlicer(0)->GetTMax() > 0) {
has_temporal=true;
break;
}
///Only play one slicer per SM, and only if the SM is being displayed
for (int i=0; i<image_number; i++)
for (int j=0; j<4; j++)
- if (mSlicerManagers[i]->GetImage()->GetVTKImages().size() > 1 &&
+ if (mSlicerManagers[i]->GetSlicer(0)->GetTMax() > 0 &&
DataTree->topLevelItem(i)->data(j+1,Qt::CheckStateRole).toInt() > 0) {
mSlicerManagers[i]->SetNextTSlice(j);
break;
void vvSlicer::SetTSlice(int t)
{
if (t < 0)
- t = 0;
+ mCurrentTSlice = 0;
else if ((unsigned int)t >= mImage->GetVTKImages().size())
- t = mImage->GetVTKImages().size() -1;
+ mCurrentTSlice = mImage->GetVTKImages().size() -1;
+ else
+ mCurrentTSlice = t;
// Update transform
mConcatenatedTransform->Identity();
- mConcatenatedTransform->Concatenate(mImage->GetTransform()[t]);
+ mConcatenatedTransform->Concatenate(mImage->GetTransform()[mCurrentTSlice]);
mConcatenatedTransform->Concatenate(mSlicingTransform);
// Update image data
- mCurrentTSlice = t;
mImageReslice->SetInput( mImage->GetVTKImages()[mCurrentTSlice] );
if (mVF && mVFActor->GetVisibility()) {
if (mVF->GetVTKImages().size() > (unsigned int)mCurrentTSlice)
}
//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+int vvSlicer::GetMaxCurrentTSlice()
+{
+ int t = mCurrentTSlice;
+ if(mOverlay)
+ t = std::max(t, mCurrentOverlayTSlice);
+ if(mFusion)
+ t = std::max(t, mCurrentFusionTSlice);
+ return t;
+}
+//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
int vvSlicer::GetFusionTSlice()
{
}
//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+int vvSlicer::GetTMax() {
+ int tmax = (int)mImage->GetVTKImages().size() - 1;
+ if(mOverlay)
+ tmax = std::max(tmax, (int)mOverlay->GetVTKImages().size()-1);
+ return tmax;
+}
+//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
void vvSlicer::SetContourSlice()
int GetTSlice();
int GetFusionTSlice();
int GetOverlayTSlice();
+ int GetMaxCurrentTSlice();
///Reimplemented from vtkImageViewer2 to add polydata support
void SetSlice(int s);
- int GetTMax() {
- return (unsigned int)mImage->GetVTKImages().size() - 1;
- }
+ int GetTMax();
void SetOpacity(double s);
void SetRenderWindow(int orientation, vtkRenderWindow * rw);
if (mLandmarks)
mLandmarks->SetTime(slice);
for ( unsigned int i = 0; i < mSlicers.size(); i++) {
- if (slice != mSlicers[i]->GetTSlice()) {
+ if (slice != mSlicers[i]->GetMaxCurrentTSlice()) {
mSlicers[i]->SetTSlice(slice);
UpdateTSlice(i);
}
//----------------------------------------------------------------------------
void vvSlicerManager::SetNextTSlice(int originating_slicer)
{
- int t = mSlicers[0]->GetTSlice();
+ int t = mSlicers[0]->GetMaxCurrentTSlice();
t++;
if (t > mSlicers[0]->GetTMax())
t = 0;
//----------------------------------------------------------------------------
void vvSlicerManager::SetPreviousTSlice(int originating_slicer)
{
- int t = mSlicers[0]->GetTSlice();
+ int t = mSlicers[0]->GetMaxCurrentTSlice();
t--;
if (t < 0)
t = mSlicers[0]->GetTMax();
if (mLandmarks)
mLandmarks->SetTime(tslice);
- if (mSlicers[slicer]->GetTSlice() == tslice) return;
+ if (mSlicers[slicer]->GetMaxCurrentTSlice() == tslice) return;
+
+ mSlicers[slicer]->SetTSlice(tslice);
if(mSlicingPreset==VOXELS_SLICING) {
vtkMatrix4x4 *imageTransformInverse = vtkMatrix4x4::New();
- mImage->GetTransform()[tslice]->GetInverse(imageTransformInverse);
+ mImage->GetTransform()[mSlicers[slicer]->GetTSlice()]->GetInverse(imageTransformInverse);
this->GetSlicer(slicer)->GetSlicingTransform()->SetMatrix(imageTransformInverse);
imageTransformInverse->Delete();
}
- mSlicers[slicer]->SetTSlice(tslice);
UpdateTSlice(slicer);
}
//----------------------------------------------------------------------------
&& mSlicers[i]->GetRenderer()->GetDraw()
&& mSlicers[i]->GetRenderWindow()->GetSize()[0] > 2
&& mSlicers[i]->GetRenderWindow()->GetSize()[1] > 2) {
- mSlicers[i]->SetCurrentPosition(p[0], p[1], p[2], mSlicers[slicer]->GetTSlice());
+ mSlicers[i]->SetCurrentPosition(p[0], p[1], p[2], mSlicers[slicer]->GetMaxCurrentTSlice());
mSlicers[i]->UpdateCursorPosition();
if (current) { //do not display corner annotation if image is the one picked
mSlicers[i]->SetCurrentPosition(-VTK_DOUBLE_MAX,-VTK_DOUBLE_MAX,
- -VTK_DOUBLE_MAX, mSlicers[slicer]->GetTSlice());
+ -VTK_DOUBLE_MAX, mSlicers[slicer]->GetMaxCurrentTSlice());
mSlicers[i]->SetCursorColor(255,10,212);
} else {
mSlicers[i]->SetCursorColor(150,10,282);
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, p[0], p[1], p[2], mSlicers[slicer]->GetTSlice());
+ emit UpdateLinkManager(*i, slicer, p[0], p[1], p[2], mSlicers[slicer]->GetMaxCurrentTSlice());
}
}
}
if (mSlicers[slicer]->GetVFActor() ) {
displayVec = 1;
- unsigned int currentTime = mSlicers[slicer]->GetTSlice();
+ unsigned int currentTime = mSlicers[slicer]->GetMaxCurrentTSlice();
vtkImageData *vf = NULL;
if (mSlicers[slicer]->GetVF()->GetVTKImages().size() > currentTime)
void vvSlicerManager::UpdateTSlice(int slicer)
{
int slice = mSlicers[slicer]->GetSlice();
- int tslice = mSlicers[slicer]->GetTSlice();
+ int tslice = mSlicers[slicer]->GetMaxCurrentTSlice();
if (mPreviousSlice[slicer] == slice) {
if (mPreviousTSlice[slicer] == tslice) {
// DD("************** NOTHING ***********");
//All type of mouse events
if (event == vtkCommand::LeaveEvent) {
this->SM->GetSlicer(VisibleInWindow)->SetCurrentPosition(-VTK_DOUBLE_MAX,-VTK_DOUBLE_MAX,
- -VTK_DOUBLE_MAX,this->SM->GetSlicer(VisibleInWindow)->GetTSlice());
+ -VTK_DOUBLE_MAX,this->SM->GetSlicer(VisibleInWindow)->GetMaxCurrentTSlice());
this->SM->GetSlicer(VisibleInWindow)->Render();
return;
}
this->SM->GetSlicer(VisibleInWindow)->GetSlicingTransform()->TransformPoint(p, pt);
this->SM->GetSlicer(VisibleInWindow)->SetCurrentPosition(pt[0],pt[1],pt[2],
- this->SM->GetSlicer(VisibleInWindow)->GetTSlice());
+ this->SM->GetSlicer(VisibleInWindow)->GetMaxCurrentTSlice());
if (newLandmark) {
this->SM->AddLandmark(xWorld,yWorld,zWorld,
this->SM->GetSlicer(VisibleInWindow)->GetTSlice());