clitkDicomRTDoseIO.cxx
clitkDicomRTDoseIOFactory.cxx
clitkOrientation.cxx
- vvImage.cxx
clitkImageToImageGenericFilterBase.cxx
clitkExceptionObject.cxx
clitkFilterBase.cxx
clitkMemoryUsage.cxx
-)
+ vvImage.cxx
+ vvImageReader.cxx
+ vvImageWriter.cxx
+)
### Declare clitkCommon library
ADD_LIBRARY(clitkCommon STATIC ${clitkCommon_SRC})
#ifndef VVIMAGEREADER_CXX
#define VVIMAGEREADER_CXX
-#include <QApplication>
#include <itkImageFileReader.h>
#include "vvImageReader.h"
#include "vvImageReader.txx"
mType = type;
mDim = dim;
mInputPixelType=inputPixelType;
- this->start(); //Start heavy read operation in a separate thread
- while (this->isRunning()) {
- qApp->processEvents();
- this->wait(50);
- }
-}
-//------------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-void vvImageReader::run()
-{
switch(mDim) {
case 2:
UpdateWithDim<2>(mInputPixelType);
#define vvImageReader_H
#include <string>
#include <vector>
-#include <QThread>
#include "itkCommand.h"
#include "vvImage.h"
-#include "vvConstants.h"
-class vvImageReader : public itk::LightObject, public QThread {
+class vvImageReader : public itk::LightObject {
public:
+ //Image types
+ typedef enum _IMAGETYPE {
+ IMAGE = 20,
+ DICOM,
+ MERGED,
+ SLICED,
+ IMAGEWITHTIME,
+ MERGEDWITHTIME,
+ VECTORFIELD,
+ UNDEFINEDIMAGETYPE
+ } LoadedImageType;
+
typedef vvImageReader Self;
typedef itk::SmartPointer<Self> Pointer;
itkNewMacro(Self);
void Update(int dim, std::string InputPixelType, LoadedImageType type);
protected:
- void run();
//====================================================================
std::vector<std::string> mInputFilenames;
///Method used to load the image, see vvConstants.h for definition
#include "clitkCommon.h"
#include "clitkConfiguration.h"
#include "vvFromITK.h"
-#include "vvConstants.h"
-
//----------------------------------------------------------------------------
template<unsigned int VImageDimension>
void vvImageReader::UpdateWithDim(std::string InputPixelType)
vtkVOXImageWriter.cxx
vvInteractorStyleNavigator.cxx
vvSlicer.cxx
- vvImageReader.cxx
- vvImageReader.txx
- vvImageWriter.cxx
- vvImageWriter.txx
vvLandmarks.cxx
vvLandmarksGlyph.cxx
vvGlyphSource.cxx
#include "clitkIO.h"
#include "vvMainWindow.h"
-#include "vvConstants.h"
-
#include <vtkFileOutputWindow.h>
#include <vtkSmartPointer.h>
#include <itkFileOutputWindow.h>
std::string current = argv[i];
if (!current.compare(0,2,"--")) { //We are parsing an option
if (parse_mode == P_SEQUENCE) {//First finish the current sequence
- window.LoadImages(sequence_filenames,MERGEDWITHTIME);
+ window.LoadImages(sequence_filenames, vvImageReader::MERGEDWITHTIME);
sequence_filenames.clear();
parse_mode=P_NORMAL;
}
} else {
std::vector<std::string> image;
image.push_back(current);
- window.LoadImages(image,IMAGE);
+ window.LoadImages(image, vvImageReader::IMAGE);
n_image_loaded++;
}
}
if (parse_mode == P_SEQUENCE) { //Finish any current sequence
- window.LoadImages(sequence_filenames,MERGEDWITHTIME);
+ window.LoadImages(sequence_filenames, vvImageReader::MERGEDWITHTIME);
sequence_filenames.clear();
parse_mode=P_NORMAL;
}
+++ /dev/null
-/*=========================================================================
- 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
-
- 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
-
- - BSD See included LICENSE.txt file
- - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
-======================================================================-====*/
-#ifndef vvConstants_h
-#define vvConstants_h
-
-//Constants used everywhere in the program
-
-//Image types
-typedef enum _IMAGETYPE {
-IMAGE = 20,
-DICOM,
-MERGED,
-SLICED,
-IMAGEWITHTIME,
-MERGEDWITHTIME,
-VECTORFIELD,
-UNDEFINEDIMAGETYPE
-} LoadedImageType;
-
-#endif
}
vvImageReader::Pointer reader = vvImageReader::New();
reader->SetInputFilename(output_filename);
- reader->Update(VECTORFIELD);
+ reader->Update(vvImageReader::VECTORFIELD);
finish=clock();
DD((finish - start)/static_cast<double>(CLOCKS_PER_SEC));
mOutput = reader->GetOutput();
#include "vvMesh.h"
#include "vvStructSelector.h"
#include "vvMeshReader.h"
-#include "vvConstants.h"
#include "clitkConfiguration.h"
// ITK include
}
}
if (vector.size() > 0)
- LoadImages(vector, MERGED);
+ LoadImages(vector, vvImageReader::MERGED);
}
//------------------------------------------------------------------------------
std::vector<std::string> vector;
for (int i = 0; i < files.size(); i++)
vector.push_back(files[i].toStdString());
- LoadImages(vector, SLICED);
+ LoadImages(vector, vvImageReader::SLICED);
}
//------------------------------------------------------------------------------
}
sort(vector.begin(),vector.end());
if (vector.size() > 1)
- LoadImages(vector, MERGEDWITHTIME);
+ LoadImages(vector, vvImageReader::MERGEDWITHTIME);
else
QMessageBox::warning(this,tr("Reading problem"),"You need to select at least two images to merge images with time.\nIf you only want to open one image, please use the \"Open Image\" function.");
}
std::cout << "dicomSeriesSelector " << std::endl;
if (dicomSeriesSelector->exec() == QDialog::Accepted) {
files = *(dicomSeriesSelector->GetFilenames());
- LoadImages(files,DICOM);
+ LoadImages(files, vvImageReader::DICOM);
}
}
//------------------------------------------------------------------------------
std::vector<std::string> vector;
for (int i = 0; i < files.size(); i++)
vector.push_back(files[i].toStdString());
- LoadImages(vector, IMAGE);
+ LoadImages(vector, vvImageReader::IMAGE);
}
//------------------------------------------------------------------------------
void vvMainWindow::OpenRecentImage()
std::vector<std::string> images;
images.push_back(caller->text().toStdString());
mInputPathName = itksys::SystemTools::GetFilenamePath(images[0]).c_str();
- LoadImages(images,IMAGE);
+ LoadImages(images, vvImageReader::IMAGE);
}
//------------------------------------------------------------------------------
for (int i = 0; i < files.size(); i++) {
vector.push_back(files[i].toStdString());
}
- LoadImages(vector, IMAGEWITHTIME);
+ LoadImages(vector, vvImageReader::IMAGEWITHTIME);
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-void vvMainWindow::LoadImages(std::vector<std::string> files, LoadedImageType filetype)
+void vvMainWindow::LoadImages(std::vector<std::string> files, vvImageReader::LoadedImageType filetype)
{
//Separate the way to open images and dicoms
int fileSize;
- if (filetype == IMAGE || filetype == IMAGEWITHTIME)
+ if (filetype == vvImageReader::IMAGE || filetype == vvImageReader::IMAGEWITHTIME)
fileSize = files.size();
else
fileSize = 1;
std::vector<unsigned int> nSlices;
nSlices.resize(files.size());
std::fill(nSlices.begin(), nSlices.end(), 1);
- if (filetype == SLICED) {
+ if (filetype == vvImageReader::SLICED) {
for (int i = 0; i < fileSize; i++) {
itk::ImageIOBase::Pointer header = clitk::readImageHeader(files[i]);
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
// Change filename if an image with the same already exist
int number = GetImageDuplicateFilenameNumber(files[i] + std::string("_slice"));
- if (filetype == IMAGE || filetype == IMAGEWITHTIME || filetype == SLICED)
+ if (filetype == vvImageReader::IMAGE || filetype == vvImageReader::IMAGEWITHTIME || filetype == vvImageReader::SLICED)
SetImageSucceed = imageManager->SetImage(files[i],filetype, number, j);
else {
SetImageSucceed = imageManager->SetImages(files,filetype, number);
bool showVertical = false;
if (mSlicerManagers[slicer]->GetSlicer(window)->GetImage()->GetNumberOfDimensions() > 3
|| (mSlicerManagers[slicer]->GetSlicer(window)->GetImage()->GetNumberOfDimensions() > 2
- && mSlicerManagers[slicer]->GetType() != IMAGEWITHTIME
- && mSlicerManagers[slicer]->GetType() != MERGEDWITHTIME))
+ && mSlicerManagers[slicer]->GetType() != vvImageReader::IMAGEWITHTIME
+ && mSlicerManagers[slicer]->GetType() != vvImageReader::MERGEDWITHTIME))
showVertical = true;
if (mSlicerManagers[slicer]->GetSlicer(window)->GetImage()->GetNumberOfDimensions() > 3
- || mSlicerManagers[slicer]->GetType() == IMAGEWITHTIME
- || mSlicerManagers[slicer]->GetType() == MERGEDWITHTIME)
+ || mSlicerManagers[slicer]->GetType() == vvImageReader::IMAGEWITHTIME
+ || mSlicerManagers[slicer]->GetType() == vvImageReader::MERGEDWITHTIME)
showHorizontal = true;
if (showVertical)
#include "ui_vvMainWindow.h"
#include "vvMainWindowBase.h"
#include "vvToolManager.h"
-#include "vvConstants.h"
+#include "vvImageReader.h"
#include "vvMesh.h"
#include "clitkMemoryUsage.h"
public:
vvMainWindow();
~vvMainWindow();
- void LoadImages(std::vector<std::string> filenames, LoadedImageType type);
+ void LoadImages(std::vector<std::string> filenames, vvImageReader::LoadedImageType type);
vvSlicerManager * AddImage(vvImage::Pointer image,std::string filename);
void AddField(QString file,int index);
void AddOverlayImage(int index, QString filename);
mFusionName = "";
mVFId = "";
mLastError = "";
- mType = UNDEFINEDIMAGETYPE;
+ mType = vvImageReader::UNDEFINEDIMAGETYPE;
mColorMap = 0;
mPreset = 0;
mOverlayColor = 130;
//----------------------------------------------------------------------------
-bool vvSlicerManager::SetImage(std::string filename, LoadedImageType type, int n, unsigned int slice)
+bool vvSlicerManager::SetImage(std::string filename, vvImageReader::LoadedImageType type, int n, unsigned int slice)
{
mType = type;
if (mReader.IsNull())
//----------------------------------------------------------------------------
-bool vvSlicerManager::SetImages(std::vector<std::string> filenames,LoadedImageType type, int n)
+bool vvSlicerManager::SetImages(std::vector<std::string> filenames, vvImageReader::LoadedImageType type, int n)
{
mType = type;
std::string fileWithoutExtension = vtksys::SystemTools::GetFilenameWithoutExtension(filenames[0]);
- if (type == DICOM)
+ if (type == vvImageReader::DICOM)
fileWithoutExtension += "_dicom";
- else if (type == MERGED)
+ else if (type == vvImageReader::MERGED)
fileWithoutExtension += "_merged";
- else if (type == MERGEDWITHTIME)
+ else if (type == vvImageReader::MERGEDWITHTIME)
fileWithoutExtension += "_merged_wt";
mFileName = vtksys::SystemTools::GetFilenameName(mFileName);
if (mVectorReader.IsNull())
mVectorReader = vvImageReader::New();
mVectorReader->SetInputFilename(filename);
- mVectorReader->Update(VECTORFIELD);
+ mVectorReader->Update(vvImageReader::VECTORFIELD);
if (mVectorReader->GetLastError().size() != 0) {
mLastError = mVectorReader->GetLastError();
return false;
//----------------------------------------------------------------------------
void vvSlicerManager::ReloadVF()
{
- mVectorReader->Update(VECTORFIELD); //deletes the old images through the VF::Init() function
+ mVectorReader->Update(vvImageReader::VECTORFIELD); //deletes the old images through the VF::Init() function
mVF=mVectorReader->GetOutput();
for ( unsigned int i = 0; i < mSlicers.size(); i++) {
mSlicers[i]->SetVF(mVF);
class vtkPolyData;
// VV
-#include "vvConstants.h"
#include "clitkCommon.h"
#include "vvImage.h"
#include "vvMesh.h"
return mLastError;
}
- bool SetImage(std::string filename,LoadedImageType type, int n=0, unsigned int slice=0);
+ bool SetImage(std::string filename, vvImageReader::LoadedImageType type, int n=0, unsigned int slice=0);
void SetImage(vvImage::Pointer image);
- bool SetImages(std::vector<std::string> filenames, LoadedImageType type, int n=0);
+ bool SetImages(std::vector<std::string> filenames, vvImageReader::LoadedImageType type, int n=0);
bool SetOverlay(std::string filename, int dim, std::string component);
bool SetFusion(std::string filename, int dim, std::string component);
double mFusionLevel;
int mPreset;
- LoadedImageType mType;
+ vvImageReader::LoadedImageType mType;
std::string mVFComponent;
std::string mOverlayComponent;
std::string mFusionComponent;
std::vector<std::string> filenames;
filenames.push_back(filename[i].toStdString());
reader->SetInputFilenames(filenames);
- reader->Update(IMAGE);
+ reader->Update(vvImageReader::IMAGE);
QApplication::restoreOverrideCursor();
if (reader->GetLastError().size() != 0) {
// Reload image
vvImageReader::Pointer reader = vvImageReader::New();
reader->SetInputFilename(mCurrentROI->GetFilename());
- reader->Update(IMAGE);
+ reader->Update(vvImageReader::IMAGE);
if (reader->GetLastError() != "") {
QMessageBox::information(mMainWindowBase, tr("Sorry, error. Could not reload"), reader->GetLastError().c_str());
return;