int index = GetSlicerIndexFromItem(item);
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
QString role=item->data(1,Qt::UserRole).toString();
- if ( role == "vector")
+ if ( role == "vector"){
mSlicerManagers[index]->ReloadVF();
- else if (role == "overlay")
+ }
+ else if (role == "overlay"){
mSlicerManagers[index]->ReloadOverlay();
- else if (role == "fusion")
+ }
+ else if (role == "fusion"){
mSlicerManagers[index]->ReloadFusion();
- else
+ }
+ else{
mSlicerManagers[index]->Reload();
-
+ }
// Update view and info
ImageInfoChanged();
mSlicerManagers[index]->Render();
#include <vtkImageAccumulate.h>
#include <vtkImageReslice.h>
-// template <class T, unsigned int dim>
-// void print_vector(const char* pmsg, T* pvec)
-// {
-// std::cout << pmsg << ": ";
-// for (unsigned int i = 0; i < dim; i++)
-// std::cout << pvec[i] << " ";
-// std::cout << std::endl;
-// }
-
-
vtkCxxRevisionMacro(vvSlicer, "DummyRevision");
vtkStandardNewMacro(vvSlicer);
-
+static void copyExtent(int* in, int* to){
+ for(int i=0; i<6; ++i) to[i]=in[i];
+}
//------------------------------------------------------------------------------
vvSlicer::vvSlicer()
{
this->UnInstallPipeline();
mImage = NULL;
+ mReducedExtent = new int[6];
mCurrentTSlice = 0;
mUseReducedExtent = false;
//------------------------------------------------------------------------------
void vvSlicer::SetReducedExtent(int * ext)
{
- mReducedExtent = ext;
+ copyExtent(ext, mReducedExtent);
}
//------------------------------------------------------------------------------
for (std::vector<vvMeshActor*>::iterator i=mSurfaceCutActors.begin();
i!=mSurfaceCutActors.end(); i++)
delete (*i);
+ delete [] mReducedExtent;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//----------------------------------------------------------------------------
-int * vvSlicer::GetExtent()
-{
+int * vvSlicer::GetExtent(){
int *w_ext;
if (mUseReducedExtent) {
w_ext = mReducedExtent;
// Local copy of extent
int w_ext[6];
- for(unsigned int i=0; i<6; i++){
- if (mUseReducedExtent)
- w_ext[i] = mReducedExtent[i];
- else
- w_ext[i] = input->GetWholeExtent()[i];
- }
-
+ copyExtent(GetExtent(), w_ext);
// Set slice value
w_ext[ this->SliceOrientation*2 ] = this->Slice;
w_ext[ this->SliceOrientation*2+1 ] = this->Slice;
// GUI Initialization
Ui_vvToolCropImage::setupUi(mToolWidget);
- // mTLabel2->setHidden(false);
- // tminSlider->setHidden(false);
- // tmaxSlider->setHidden(false);
- // spin_tmin->setHidden(false);
- // spin_tmax->setHidden(false);
- // mLabelTimeCropping->setHidden(false);
mTLabel1->setHidden(true);
mTLabel2->setHidden(true);
tminSlider->setHidden(true);
mSliders[zmax]=zmaxSlider;
mSliders[tmin]=tminSlider;
mSliders[tmax]=tmaxSlider;
+
+ // Record initial extend
+ mReducedExtent = new int[6];
+ mInitialExtent = new int[6];
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
vvToolCropImage::~vvToolCropImage()
{
-
+ delete [] mReducedExtent;
+ delete [] mInitialExtent;
}
//------------------------------------------------------------------------------
void vvToolCropImage::closeEvent(QCloseEvent *event)
{
if(mCurrentSlicerManager){
- // Reset extends
- for(int i=0; i<mExtentSize; i++) mReducedExtent[i] = mInitialExtent[i];
- UpdateExtent();
+// Reset extends
+ for(int i=0; i<mExtentSize; i++){
+ mReducedExtent[i] = mInitialExtent[i];
+ }
+ UpdateExtent();
}
- event->accept();
+ vvToolWidgetBase::closeEvent(event);
}
//------------------------------------------------------------------------------
spin_zmax->setHidden(true);
}
- // Record initial extend
- mReducedExtent = new int[mExtentSize];
- mInitialExtent = new int[mExtentSize];
- mReducedExtent = mCurrentSlicerManager->GetImage()->GetFirstVTKImageData()->GetWholeExtent();
- for(int i=0; i<mExtentSize; i++) mInitialExtent[i] = mReducedExtent[i];
+ int *a = mCurrentImage->GetFirstVTKImageData()->GetWholeExtent();
+ for(int i=0; i<6; i++){
+ mInitialExtent[i] = a[i];
+ mReducedExtent[i] = a[i];
+ }
for(int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
mCurrentSlicerManager->GetSlicer(i)->EnableReducedExtent(true);
+ mCurrentSlicerManager->GetSlicer(i)->SetReducedExtent(mInitialExtent);
}
- // Set initial sliders values
+// Set initial sliders values
std::vector<int> imsize = mCurrentSlicerManager->GetImage()->GetSize();
for(int dim=0; dim<slicer->GetDimension() && dim<3; ++dim){
mSliders[dim*2]->setMaximum(imsize[dim]-1);
signalMapper->setMapping(mSliders[i], i);
connect(mSliders[i], SIGNAL(valueChanged(int)), signalMapper, SLOT(map()));
}
-
-
-
-
- // connect(mCurrentSlicerManager,SIGNAL(UpdateSlice(int,int)),this,SLOT(UpdateExtent()));
- //connect(mCurrentSlicerManager,SIGNAL(UpdateTSlice(int,int)),this,SLOT(UpdateExtent()));
-
- // connect(mIntensitySlider, SIGNAL(valueChanged(double)), this, SLOT(autoCropValueChanged(double)));
UpdateExtent();
}
//------------------------------------------------------------------------------