From 2dab98a87246da49fb09c2529415eefaa4f987e6 Mon Sep 17 00:00:00 2001 From: dsarrut Date: Wed, 7 Jul 2010 07:05:51 +0000 Subject: [PATCH] cosmetic --- vv/vvImageWriter.cxx | 25 ++++---- vv/vvImageWriter.h | 80 +++++++++++++------------- vv/vvMesh.cxx | 17 ++++-- vv/vvProgressDialog.h | 46 +++++++-------- vv/vvSlicerManager.cxx | 128 ++++++++++++++++++++--------------------- 5 files changed, 155 insertions(+), 141 deletions(-) diff --git a/vv/vvImageWriter.cxx b/vv/vvImageWriter.cxx index 7c09c35..4a5714e 100644 --- a/vv/vvImageWriter.cxx +++ b/vv/vvImageWriter.cxx @@ -15,13 +15,15 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html ======================================================================-====*/ -#ifndef vvImageWriter_CXX -#define vvImageWriter_CXX +#ifndef VVIMAGEWRITER_CXX +#define VVIMAGEWRITER_CXX + #include "vvImageWriter.h" #include "vvImageWriter.txx" #include -//==================================================================== + +//------------------------------------------------------------------------------ vvImageWriter::vvImageWriter() { mImage = NULL; @@ -29,15 +31,17 @@ vvImageWriter::vvImageWriter() mLastError = ""; mUseAnObserver = false; } -//==================================================================== +//------------------------------------------------------------------------------ + -//==================================================================== +//------------------------------------------------------------------------------ vvImageWriter::~vvImageWriter() { } -//==================================================================== +//------------------------------------------------------------------------------ -//==================================================================== + +//------------------------------------------------------------------------------ void vvImageWriter::Update(int dim,std::string OutputPixelType) { //CALL_FOR_ALL_DIMS(dim,UpdateWithDim,inputPixelType); @@ -50,14 +54,15 @@ void vvImageWriter::Update(int dim,std::string OutputPixelType) else std::cerr << "dim not know in Update ! " << std::endl; } -//==================================================================== +//------------------------------------------------------------------------------ + -//==================================================================== +//------------------------------------------------------------------------------ void vvImageWriter::SetOutputFileName(std::string filename) { mOutputFilename = filename; } -//==================================================================== +//------------------------------------------------------------------------------ #endif diff --git a/vv/vvImageWriter.h b/vv/vvImageWriter.h index e39cc64..e9a9c38 100644 --- a/vv/vvImageWriter.h +++ b/vv/vvImageWriter.h @@ -14,7 +14,7 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html -======================================================================-====*/ + ======================================================================-====*/ #ifndef vvImageWriter_H #define vvImageWriter_H #include @@ -27,52 +27,52 @@ class vvImageWriter { public: - // constructor - vvImageWriter(); - ~vvImageWriter(); - - void SetOutputFileName(std::string filename); - void SetObserver(itk::Command::Pointer o) { - mUseAnObserver = true; - mObserver = o; - } - void DisableObserver() { - mUseAnObserver = false; - } - - void SetInput(vvImage::Pointer image) { - mImage = image; - } - - std::string GetLastError() { - return mLastError; - } - - //==================================================================== - // Main function - void Update() { - Update(mImage->GetNumberOfDimensions(),mImage->GetScalarTypeAsString()); - } - void Update(int dim, std::string OutputPixelType); + // constructor + vvImageWriter(); + ~vvImageWriter(); + + void SetOutputFileName(std::string filename); + void SetObserver(itk::Command::Pointer o) { + mUseAnObserver = true; + mObserver = o; + } + void DisableObserver() { + mUseAnObserver = false; + } + + void SetInput(vvImage::Pointer image) { + mImage = image; + } + + std::string GetLastError() { + return mLastError; + } + + //==================================================================== + // Main function + void Update() { + Update(mImage->GetNumberOfDimensions(),mImage->GetScalarTypeAsITKString()); + } + void Update(int dim, std::string OutputPixelType); protected: - //==================================================================== - std::string mOutputFilename; - itk::Command::Pointer mObserver; + //==================================================================== + std::string mOutputFilename; + itk::Command::Pointer mObserver; - std::string mLastError; - bool mUseAnObserver; + std::string mLastError; + bool mUseAnObserver; - //==================================================================== - template - void UpdateWithDim(std::string OutputPixelType); + //==================================================================== + template + void UpdateWithDim(std::string OutputPixelType); - //==================================================================== - template - void UpdateWithDimAndOutputPixelType(); + //==================================================================== + template + void UpdateWithDimAndOutputPixelType(); private: - vvImage::Pointer mImage; + vvImage::Pointer mImage; }; // end class vvImageWriter diff --git a/vv/vvMesh.cxx b/vv/vvMesh.cxx index d666a21..ed9d074 100644 --- a/vv/vvMesh.cxx +++ b/vv/vvMesh.cxx @@ -15,9 +15,22 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html ======================================================================-====*/ + +//std #include #include #include + +// clitk +#include "clitkCommon.h" + +// vv +#include "vvMesh.h" + +// itk +#include + +// vtk #include #include #include @@ -25,14 +38,10 @@ #include #include #include -#include "clitkCommon.h" -#include "vvMesh.h" #include #include #include #include -#include - #include vvMesh::vvMesh() : diff --git a/vv/vvProgressDialog.h b/vv/vvProgressDialog.h index cf223ed..7742773 100644 --- a/vv/vvProgressDialog.h +++ b/vv/vvProgressDialog.h @@ -14,7 +14,7 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html -======================================================================-====*/ + ======================================================================-====*/ #ifndef vvProgressDialog_h #define vvProgressDialog_h #include "ui_vvProgressDialog.h" @@ -22,28 +22,28 @@ class vvProgressDialog : public QDialog, private Ui::vvProgressDialog { - Q_OBJECT - -public: - vvProgressDialog(std::string message,bool show_progress=false) { - setupUi(this); - textLabel->setText(message.c_str()); - if (show_progress) - progressBar->show(); - else - progressBar->hide(); - this->show(); - } - void Update(std::string message) - { - textLabel->setText(message.c_str()); - } - void SetProgress(unsigned int current,unsigned int max) - { - progressBar->setMaximum(max); - progressBar->setValue(current); - } - ~vvProgressDialog() {} + Q_OBJECT + + public: + vvProgressDialog(std::string message,bool show_progress=false) { + setupUi(this); + textLabel->setText(message.c_str()); + if (show_progress) + progressBar->show(); + else + progressBar->hide(); + this->show(); + } + void Update(std::string message) + { + textLabel->setText(message.c_str()); + } + void SetProgress(unsigned int current,unsigned int max) + { + progressBar->setMaximum(max); + progressBar->setValue(current); + } + ~vvProgressDialog() {} public slots: diff --git a/vv/vvSlicerManager.cxx b/vv/vvSlicerManager.cxx index c896420..2ed8c2e 100644 --- a/vv/vvSlicerManager.cxx +++ b/vv/vvSlicerManager.cxx @@ -1,20 +1,20 @@ /*========================================================================= -Program: vv http://www.creatis.insa-lyon.fr/rio/vv + Program: vv http://www.creatis.insa-lyon.fr/rio/vv -Authors belong to: -- University of LYON http://www.universite-lyon.fr/ -- Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr -- CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr + Authors belong to: + - University of LYON http://www.universite-lyon.fr/ + - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr + - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr -This software is distributed WITHOUT ANY WARRANTY; without even -the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. See the copyright notices for more information. + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the copyright notices for more information. -It is distributed under dual licence + It is distributed under dual licence -- BSD See included LICENSE.txt file -- CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html -======================================================================-====*/ + - BSD See included LICENSE.txt file + - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html + ======================================================================-====*/ #include "vvSlicerManager.h" #include "vvSlicer.h" @@ -396,31 +396,31 @@ void vvSlicerManager::SetInteractorStyleNavigator(int i, vtkInteractorStyle* sty mSlicers[i]->GetRenderWindow()->GetInteractor()->SetInteractorStyle(style); mSlicers[i]->GetRenderWindow()->GetInteractor()-> - GetInteractorStyle()->AddObserver(vtkCommand::KeyPressEvent, smc); + GetInteractorStyle()->AddObserver(vtkCommand::KeyPressEvent, smc); mSlicers[i]->GetRenderWindow()->GetInteractor()-> - GetInteractorStyle()->AddObserver(vtkCommand::WindowLevelEvent, smc); + GetInteractorStyle()->AddObserver(vtkCommand::WindowLevelEvent, smc); mSlicers[i]->GetRenderWindow()->GetInteractor()-> - GetInteractorStyle()->AddObserver(vtkCommand::EndWindowLevelEvent, smc); + GetInteractorStyle()->AddObserver(vtkCommand::EndWindowLevelEvent, smc); mSlicers[i]->GetRenderWindow()->GetInteractor()-> - GetInteractorStyle()->AddObserver(vtkCommand::StartWindowLevelEvent, smc); + GetInteractorStyle()->AddObserver(vtkCommand::StartWindowLevelEvent, smc); mSlicers[i]->GetRenderWindow()->GetInteractor()-> - GetInteractorStyle()->AddObserver(vtkCommand::PickEvent, smc); + GetInteractorStyle()->AddObserver(vtkCommand::PickEvent, smc); mSlicers[i]->GetRenderWindow()->GetInteractor()-> - GetInteractorStyle()->AddObserver(vtkCommand::StartPickEvent, smc); + GetInteractorStyle()->AddObserver(vtkCommand::StartPickEvent, smc); mSlicers[i]->GetRenderWindow()->GetInteractor()-> - GetInteractorStyle()->AddObserver(vtkCommand::LeaveEvent, smc); + GetInteractorStyle()->AddObserver(vtkCommand::LeaveEvent, smc); mSlicers[i]->GetRenderWindow()->GetInteractor()-> - GetInteractorStyle()->AddObserver(vtkCommand::UserEvent, smc); + GetInteractorStyle()->AddObserver(vtkCommand::UserEvent, smc); mSlicers[i]->GetRenderWindow()->GetInteractor()-> - GetInteractorStyle()->AddObserver(vtkCommand::MouseWheelForwardEvent, smc); + GetInteractorStyle()->AddObserver(vtkCommand::MouseWheelForwardEvent, smc); mSlicers[i]->GetRenderWindow()->GetInteractor()-> - GetInteractorStyle()->AddObserver(vtkCommand::MouseWheelBackwardEvent, smc); + GetInteractorStyle()->AddObserver(vtkCommand::MouseWheelBackwardEvent, smc); // mSlicers[i]->GetRenderWindow()->GetInteractor()-> // GetInteractorStyle()->AddObserver(vtkCommand::LeftButtonReleaseEvent, smc); mSlicers[i]->GetRenderWindow()->GetInteractor()-> - GetInteractorStyle()->AddObserver(vtkCommand::EndPickEvent, smc); + GetInteractorStyle()->AddObserver(vtkCommand::EndPickEvent, smc); mSlicers[i]->GetRenderWindow()->GetInteractor()-> - GetInteractorStyle()->AddObserver(vtkCommand::EndInteractionEvent, smc); + GetInteractorStyle()->AddObserver(vtkCommand::EndInteractionEvent, smc); smc->Delete(); } //---------------------------------------------------------------------------- @@ -462,8 +462,8 @@ void vvSlicerManager::SetNextTSlice(int originating_slicer) if (t > mSlicers[0]->GetTMax()) t = 0; // DD("SetNextTSlice"); -// DD(originating_slicer); -// DD(t); + // DD(originating_slicer); + // DD(t); emit UpdateTSlice(originating_slicer,t); } //---------------------------------------------------------------------------- @@ -552,15 +552,15 @@ void vvSlicerManager::SetOpacity(int i, double factor) void vvSlicerManager::UpdateViews(int current,int slicer) { // DD("UpdateViews"); -// DD(current); -// DD(slicer); + // DD(current); + // DD(slicer); double x = (mSlicers[slicer]->GetCurrentPosition()[0] - mSlicers[slicer]->GetInput()->GetOrigin()[0]) - /mSlicers[slicer]->GetInput()->GetSpacing()[0]; + /mSlicers[slicer]->GetInput()->GetSpacing()[0]; double y = (mSlicers[slicer]->GetCurrentPosition()[1] - mSlicers[slicer]->GetInput()->GetOrigin()[1]) - /mSlicers[slicer]->GetInput()->GetSpacing()[1]; + /mSlicers[slicer]->GetInput()->GetSpacing()[1]; double z = (mSlicers[slicer]->GetCurrentPosition()[2] - mSlicers[slicer]->GetInput()->GetOrigin()[2]) - /mSlicers[slicer]->GetInput()->GetSpacing()[2]; + /mSlicers[slicer]->GetInput()->GetSpacing()[2]; if (x >= mSlicers[slicer]->GetInput()->GetWholeExtent()[0] && x <= mSlicers[slicer]->GetInput()->GetWholeExtent()[1] && @@ -647,11 +647,11 @@ void vvSlicerManager::UpdateViews(int current,int slicer) void vvSlicerManager::UpdateLinked(int slicer) { double x = (mSlicers[slicer]->GetCurrentPosition()[0] - mSlicers[slicer]->GetInput()->GetOrigin()[0]) - /mSlicers[slicer]->GetInput()->GetSpacing()[0]; + /mSlicers[slicer]->GetInput()->GetSpacing()[0]; double y = (mSlicers[slicer]->GetCurrentPosition()[1] - mSlicers[slicer]->GetInput()->GetOrigin()[1]) - /mSlicers[slicer]->GetInput()->GetSpacing()[1]; + /mSlicers[slicer]->GetInput()->GetSpacing()[1]; double z = (mSlicers[slicer]->GetCurrentPosition()[2] - mSlicers[slicer]->GetInput()->GetOrigin()[2]) - /mSlicers[slicer]->GetInput()->GetSpacing()[2]; + /mSlicers[slicer]->GetInput()->GetSpacing()[2]; if (x >= mSlicers[slicer]->GetInput()->GetWholeExtent()[0] && x <= mSlicers[slicer]->GetInput()->GetWholeExtent()[1] && @@ -863,11 +863,11 @@ void vvSlicerManager::UpdateInfoOnCursorPosition(int slicer) double y = mSlicers[slicer]->GetCursorPosition()[1]; double z = mSlicers[slicer]->GetCursorPosition()[2]; double X = (x - mSlicers[slicer]->GetInput()->GetOrigin()[0])/ - mSlicers[slicer]->GetInput()->GetSpacing()[0]; + mSlicers[slicer]->GetInput()->GetSpacing()[0]; double Y = (y - mSlicers[slicer]->GetInput()->GetOrigin()[1])/ - mSlicers[slicer]->GetInput()->GetSpacing()[1]; + mSlicers[slicer]->GetInput()->GetSpacing()[1]; double Z = (z - mSlicers[slicer]->GetInput()->GetOrigin()[2])/ - mSlicers[slicer]->GetInput()->GetSpacing()[2]; + mSlicers[slicer]->GetInput()->GetSpacing()[2]; double value = -VTK_DOUBLE_MAX; int displayVec = 0; double xVec=0, yVec=0, zVec=0, valueVec=0; @@ -881,9 +881,9 @@ void vvSlicerManager::UpdateInfoOnCursorPosition(int slicer) Z >= mSlicers[slicer]->GetInput()->GetWholeExtent()[4] && Z <= mSlicers[slicer]->GetInput()->GetWholeExtent()[5]) { value = mSlicers[slicer]->GetInput()->GetScalarComponentAsDouble( - (int)floor(X), - (int)floor(Y), - (int)floor(Z),0); + (int)floor(X), + (int)floor(Y), + (int)floor(Z),0); if (mSlicers[slicer]->GetVFActor() && mSlicers[slicer]->GetVFActor()->GetVisibility()) { displayVec = 1; unsigned int currentTime = mSlicers[slicer]->GetTSlice(); @@ -907,11 +907,11 @@ void vvSlicerManager::UpdateInfoOnCursorPosition(int slicer) if (mSlicers[slicer]->GetOverlayActor() && mSlicers[slicer]->GetOverlayActor()->GetVisibility()) { displayOver = 1; double Xover = (x - mSlicers[slicer]->GetOverlay()->GetOrigin()[0]) - /mSlicers[slicer]->GetOverlay()->GetSpacing()[0]; + /mSlicers[slicer]->GetOverlay()->GetSpacing()[0]; double Yover = (y - mSlicers[slicer]->GetOverlay()->GetOrigin()[1]) - /mSlicers[slicer]->GetOverlay()->GetSpacing()[1]; + /mSlicers[slicer]->GetOverlay()->GetSpacing()[1]; double Zover = (z - mSlicers[slicer]->GetOverlay()->GetOrigin()[2]) - /mSlicers[slicer]->GetOverlay()->GetSpacing()[2]; + /mSlicers[slicer]->GetOverlay()->GetSpacing()[2]; if (Xover >= mSlicers[slicer]->GetOverlayMapper()->GetInput()->GetWholeExtent()[0] && Xover <= mSlicers[slicer]->GetOverlayMapper()->GetInput()->GetWholeExtent()[1] && Yover >= mSlicers[slicer]->GetOverlayMapper()->GetInput()->GetWholeExtent()[2] && @@ -919,20 +919,20 @@ void vvSlicerManager::UpdateInfoOnCursorPosition(int slicer) Zover >= mSlicers[slicer]->GetOverlayMapper()->GetInput()->GetWholeExtent()[4] && Zover <= mSlicers[slicer]->GetOverlayMapper()->GetInput()->GetWholeExtent()[5]) { valueOver = static_cast(mSlicers[slicer]->GetOverlayMapper()->GetInput())-> - GetScalarComponentAsDouble( - (int)floor(Xover), - (int)floor(Yover), - (int)floor(Zover),0); + GetScalarComponentAsDouble( + (int)floor(Xover), + (int)floor(Yover), + (int)floor(Zover),0); } } if (mSlicers[slicer]->GetFusionActor() && mSlicers[slicer]->GetFusionActor()->GetVisibility()) { displayFus = 1; double Xfus = (x - mSlicers[slicer]->GetFusion()->GetOrigin()[0]) - /mSlicers[slicer]->GetFusion()->GetSpacing()[0]; + /mSlicers[slicer]->GetFusion()->GetSpacing()[0]; double Yfus = (y - mSlicers[slicer]->GetFusion()->GetOrigin()[1]) - /mSlicers[slicer]->GetFusion()->GetSpacing()[1]; + /mSlicers[slicer]->GetFusion()->GetSpacing()[1]; double Zfus = (z - mSlicers[slicer]->GetFusion()->GetOrigin()[2]) - /mSlicers[slicer]->GetFusion()->GetSpacing()[2]; + /mSlicers[slicer]->GetFusion()->GetSpacing()[2]; if (Xfus >= mSlicers[slicer]->GetFusionMapper()->GetInput()->GetWholeExtent()[0] && Xfus <= mSlicers[slicer]->GetFusionMapper()->GetInput()->GetWholeExtent()[1] && Yfus >= mSlicers[slicer]->GetFusionMapper()->GetInput()->GetWholeExtent()[2] && @@ -940,10 +940,10 @@ void vvSlicerManager::UpdateInfoOnCursorPosition(int slicer) Zfus >= mSlicers[slicer]->GetFusionMapper()->GetInput()->GetWholeExtent()[4] && Zfus <= mSlicers[slicer]->GetFusionMapper()->GetInput()->GetWholeExtent()[5]) { valueFus = static_cast(mSlicers[slicer]->GetFusionMapper()->GetInput())-> - GetScalarComponentAsDouble( - (int)floor(Xfus), - (int)floor(Yfus), - (int)floor(Zfus),0); + GetScalarComponentAsDouble( + (int)floor(Xfus), + (int)floor(Yfus), + (int)floor(Zfus),0); } } emit UpdatePosition(mSlicers[slicer]->GetCursorVisibility(), @@ -982,8 +982,8 @@ void vvSlicerManager::UpdateWindowLevel() void vvSlicerManager::UpdateSlice(int slicer) { // DD("vvSlicerManager::UpdateSlice emit UpdateSlice"); -// DD(slicer); -// DD(mSlicers[slicer]->GetSlice()); + // DD(slicer); + // DD(mSlicers[slicer]->GetSlice()); if (mPreviousSlice[slicer] == mSlicers[slicer]->GetSlice()) { //DD("============= NOTHING"); return; @@ -999,9 +999,9 @@ void vvSlicerManager::UpdateSlice(int slicer) void vvSlicerManager::UpdateTSlice(int slicer) { // DD("vvSlicerManager::UpdateTSlice emit UpdateTSlice"); -// DD(slicer); -// DD(mSlicers[slicer]->GetTSlice()); -// DD(mSlicers[slicer]->GetSlice()); + // DD(slicer); + // DD(mSlicers[slicer]->GetTSlice()); + // DD(mSlicers[slicer]->GetSlice()); if (mPreviousSlice[slicer] == mSlicers[slicer]->GetSlice()) { if (mPreviousTSlice[slicer] == mSlicers[slicer]->GetTSlice()) { // DD("************** NOTHING ***********"); @@ -1032,7 +1032,7 @@ void vvSlicerManager::SetPreset(int preset) double window = mSlicers[0]->GetColorWindow(); double level = mSlicers[0]->GetColorLevel(); - std::string component_type=mImage->GetScalarTypeAsString(); + std::string component_type=mImage->GetScalarTypeAsITKString(); switch (preset) { case 0: if (component_type == "unsigned_char") { @@ -1193,7 +1193,7 @@ void vvSlicerManager::SetColorMap(int colormap) invLUT->SetHueRange(double((mOverlayColor+180)%360)/360,double((mOverlayColor+180)%360)/360); invLUT->Build(); dynamic_cast(mSlicers[i]->GetWindowLevel()) - ->SetWindowLevelMode(true); + ->SetWindowLevelMode(true); mSlicers[i]->GetWindowLevel()->SetLookupTable(supLUT); mSlicers[i]->GetOverlayMapper()->SetLookupTable(invLUT); invLUT->Delete(); @@ -1244,9 +1244,9 @@ void vvSlicerManager::AddLandmark(float x,float y,float z,float t) z_index >= mSlicers[0]->GetInput()->GetWholeExtent()[4] && z_index <= mSlicers[0]->GetInput()->GetWholeExtent()[5]) { double value = mSlicers[0]->GetInput()->GetScalarComponentAsDouble( - (int)x_index, - (int)y_index, - (int)z_index,0); + (int)x_index, + (int)y_index, + (int)z_index,0); this->GetLandmarks()->AddLandmark(x,y,z,t,value); emit LandmarkAdded(); } -- 2.47.1