Commit 28d988d4 authored by Emmanuel Promayon's avatar Emmanuel Promayon
Browse files

FIXED remove QTextStream abuse

parent 7fa9505b
......@@ -25,10 +25,8 @@
#include "AnisotropicDiffusion.h"
#include <Application.h>
#include <ItkProgressObserver.h>
#include <QMessageBox>
#include <QString>
#include <QTextStream>
#include <itkImageToVTKImageFilter.h>
#include <itkVTKImageToImageFilter.h>
......@@ -99,8 +97,8 @@ AnisotropicDiffusion::AnisoDiffType AnisotropicDiffusion::getDiffusionType() {
// --------------- apply -------------------
Action::ApplyStatus AnisotropicDiffusion::apply() {
foreach (Component * comp, getTargets()) {
ImageComponent* input = dynamic_cast<ImageComponent*> ( comp );
foreach (Component* comp, getTargets()) {
ImageComponent* input = dynamic_cast<ImageComponent*>(comp);
process(input);
}
return SUCCESS;
......@@ -115,10 +113,8 @@ void AnisotropicDiffusion::process(ImageComponent* comp) {
// ITK filter implementation using templates
vtkSmartPointer<vtkImageData> inputImage = comp->getImageData();
vtkSmartPointer<vtkImageData> outputImage = implementProcess (inputImage);
QString newName;
QTextStream(&newName) << comp->getName() << "_anisoDiff";
ImageComponent* outputComp = new ImageComponent(outputImage, newName);
vtkSmartPointer<vtkImageData> outputImage = implementProcess(inputImage);
ImageComponent* outputComp = new ImageComponent(outputImage, comp->getName() + "_anisoDiff");
// consider frame policy on new image created
Action::applyTargetPosition(comp, outputComp);
......
......@@ -25,14 +25,10 @@
// CamiTK includes
#include "CannyEdgeDetection.h"
#include <Application.h>
#include <Property.h>
// Qt includes
#include <QMessageBox>
#include <QString>
#include <QTextStream>
// ITK includes
#include <ItkProgressObserver.h>
#include <itkImageToVTKImageFilter.h>
......@@ -84,8 +80,8 @@ CannyEdgeDetection::~CannyEdgeDetection() {
// --------------- apply -------------------
Action::ApplyStatus CannyEdgeDetection::apply() {
foreach (Component * comp, getTargets()) {
ImageComponent* input = dynamic_cast<ImageComponent*> ( comp );
foreach (Component* comp, getTargets()) {
ImageComponent* input = dynamic_cast<ImageComponent*>(comp);
process(input);
}
return SUCCESS;
......@@ -99,10 +95,8 @@ void CannyEdgeDetection::process(ImageComponent* comp) {
this->lowerThreshold = property("Lower threshold").toDouble();
// ITK filter implementation using templates
vtkSmartPointer<vtkImageData> inputImage = comp->getImageData();
vtkSmartPointer<vtkImageData> outputImage = implementProcess (inputImage);
QString newName;
QTextStream(&newName) << comp->getName() << "_edges";
ImageComponent* outputComp = new ImageComponent(outputImage, newName);
vtkSmartPointer<vtkImageData> outputImage = implementProcess(inputImage);
ImageComponent* outputComp = new ImageComponent(outputImage, comp->getName() + "_edges");
// consider frame policy on new image created
Action::applyTargetPosition(comp, outputComp);
......@@ -166,9 +160,9 @@ vtkSmartPointer<vtkImageData> CannyEdgeDetection::itkProcess(vtkSmartPointer<vtk
observer->Reset();
cannyFilter->SetInput(toDoubleFilter->GetOutput());
cannyFilter->SetVariance( variance );
cannyFilter->SetUpperThreshold( upperThreshold );
cannyFilter->SetLowerThreshold( lowerThreshold );
cannyFilter->SetVariance(variance);
cannyFilter->SetUpperThreshold(upperThreshold);
cannyFilter->SetLowerThreshold(lowerThreshold);
cannyFilter->AddObserver(itk::ProgressEvent(), observer);
cannyFilter->Update();
......
......@@ -25,10 +25,8 @@
#include "ConnectedComponents.h"
#include <Application.h>
#include <ItkProgressObserver.h>
#include <QMessageBox>
#include <QString>
#include <QTextStream>
#include <itkImageToVTKImageFilter.h>
#include <itkVTKImageToImageFilter.h>
......@@ -69,8 +67,8 @@ void ConnectedComponents::setNbConnectedComponents(const int nbConnectedComponen
// --------------- apply -------------------
Action::ApplyStatus ConnectedComponents::apply() {
foreach (Component * comp, getTargets()) {
ImageComponent* input = dynamic_cast<ImageComponent*> ( comp );
foreach (Component* comp, getTargets()) {
ImageComponent* input = dynamic_cast<ImageComponent*>(comp);
process(input);
}
return SUCCESS;
......@@ -79,16 +77,13 @@ Action::ApplyStatus ConnectedComponents::apply() {
void ConnectedComponents::process(ImageComponent* comp) {
// ITK filter implementation using templates
vtkSmartPointer<vtkImageData> inputImage = comp->getImageData();
vtkSmartPointer<vtkImageData> outputImage = implementProcess (inputImage);
QString newName;
QTextStream(&newName) << comp->getName() << "_cc";
ImageComponent* outputComp = new ImageComponent(outputImage, newName);
vtkSmartPointer<vtkImageData> outputImage = implementProcess(inputImage);
ImageComponent* outputComp = new ImageComponent(outputImage, comp->getName() + "_cc");
// consider frame policy on new image created
Action::applyTargetPosition(comp, outputComp);
Application::refresh();
}
#include "ConnectedComponents.impl"
......@@ -134,9 +129,9 @@ vtkSmartPointer<vtkImageData> ConnectedComponents::itkProcess(vtkSmartPointer<vt
vtkToItkFilter->SetInput(img);
// For the filter itself
filter->SetInput(vtkToItkFilter->GetOutput());
filter->AddObserver ( itk::ProgressEvent(), observer );
filter->AddObserver(itk::ProgressEvent(), observer);
relabelFilter->AddObserver( itk::ProgressEvent(), observerRelabel );
relabelFilter->AddObserver(itk::ProgressEvent(), observerRelabel);
relabelFilter->SetInput(filter->GetOutput());
// From ITK to VTK
......
......@@ -36,15 +36,8 @@
#include <itkRescaleIntensityImageFilter.h>
#include <itkDerivativeImageFilter.h>
// Qt includes
#include <QMessageBox>
#include <QString>
#include <QTextStream>
using namespace camitk;
// --------------- constructor -------------------
Derivative::Derivative(ActionExtension* extension) : Action(extension) {
// Setting name, description and input component
......@@ -98,8 +91,8 @@ Derivative::~Derivative() {
// --------------- apply -------------------
Action::ApplyStatus Derivative::apply() {
foreach (Component * comp, getTargets()) {
ImageComponent* input = dynamic_cast<ImageComponent*> ( comp );
foreach (Component* comp, getTargets()) {
ImageComponent* input = dynamic_cast<ImageComponent*>(comp);
this->process(input);
}
return SUCCESS;
......@@ -113,10 +106,9 @@ void Derivative::process(ImageComponent* comp) {
// ITK filter implementation using templates
vtkSmartPointer<vtkImageData> inputImage = comp->getImageData();
vtkSmartPointer<vtkImageData> outputImage = implementProcess (inputImage);
QString newName;
QTextStream(&newName) << comp->getName() << "_processed";
ImageComponent* outputComp = new ImageComponent(outputImage, newName);
vtkSmartPointer<vtkImageData> outputImage = implementProcess(inputImage);
ImageComponent* outputComp = new ImageComponent(outputImage, comp->getName() + "_processed");
// consider frame policy on new image created
Action::applyTargetPosition(comp, outputComp);
......
......@@ -29,11 +29,6 @@
#include <ItkProgressObserver.h>
#include <Property.h>
// Qt includes
#include <QMessageBox>
#include <QString>
#include <QTextStream>
// ITK includes
#include <itkImageToVTKImageFilter.h>
#include <itkVTKImageToImageFilter.h>
......@@ -107,9 +102,7 @@ void GaussianFilter::process(ImageComponent* comp) {
vtkSmartPointer<vtkImageData> inputImage = comp->getImageData();
vtkSmartPointer<vtkImageData> outputImage = implementProcess(inputImage);
QString newName;
QTextStream(&newName) << comp->getName() << "_gaussian";
ImageComponent* outputComp = new ImageComponent(outputImage, newName);
ImageComponent* outputComp = new ImageComponent(outputImage, comp->getName() + "_gaussian");
// consider frame policy on new image created
Action::applyTargetPosition(comp, outputComp);
......
......@@ -25,10 +25,8 @@
#include "GradientMagnitude.h"
#include <Application.h>
#include <ItkProgressObserver.h>
#include <QMessageBox>
#include <QString>
#include <QTextStream>
#include <itkImageToVTKImageFilter.h>
#include <itkVTKImageToImageFilter.h>
#include <itkGradientMagnitudeImageFilter.h>
......@@ -69,10 +67,8 @@ void GradientMagnitude::process(ImageComponent* comp) {
// ITK filter implementation using templates
vtkSmartPointer<vtkImageData> inputImage = comp->getImageData();
vtkSmartPointer<vtkImageData> outputImage = implementProcess (inputImage);
QString newName;
QTextStream(&newName) << comp->getName() << "_gradient";
ImageComponent* outputComp = new ImageComponent(outputImage, newName);
ImageComponent* outputComp = new ImageComponent(outputImage, comp->getName() + "_gradient");
// consider frame policy on new image created
Action::applyTargetPosition(comp, outputComp);
......
......@@ -29,11 +29,6 @@
#include <ItkProgressObserver.h>
#include <Property.h>
// Qt includes
#include <QMessageBox>
#include <QString>
#include <QTextStream>
// ITK includes
#include <itkImageToVTKImageFilter.h>
#include <itkVTKImageToImageFilter.h>
......@@ -93,10 +88,8 @@ void GradientMagnitudeRecursiveGaussian::process(ImageComponent* comp) {
// ITK filter implementation using templates
vtkSmartPointer<vtkImageData> inputImage = comp->getImageData();
vtkSmartPointer<vtkImageData> outputImage = implementProcess (inputImage);
QString newName;
QTextStream(&newName) << comp->getName() << "_smoothedGradient";
ImageComponent* outputComp = new ImageComponent(outputImage, newName);
ImageComponent* outputComp = new ImageComponent(outputImage, comp->getName() + "_smoothedGradient");
// consider frame policy on new image created
Action::applyTargetPosition(comp, outputComp);
......
......@@ -29,11 +29,6 @@
#include <ItkProgressObserver.h>
#include <Property.h>
// Qt includes
#include <QMessageBox>
#include <QString>
#include <QTextStream>
// Itk includes
#include <itkImageToVTKImageFilter.h>
#include <itkVTKImageToImageFilter.h>
......@@ -87,10 +82,7 @@ void Laplacian::process(ImageComponent* comp) {
// ITK filter implementation using templates
vtkSmartPointer<vtkImageData> inputImage = comp->getImageData();
vtkSmartPointer<vtkImageData> outputImage = implementProcess (inputImage);
QString newName;
QTextStream(&newName) << comp->getName() << "_laplacian";
ImageComponent* outputComp = new ImageComponent(outputImage, newName);
ImageComponent* outputComp = new ImageComponent(outputImage, comp->getName() + "_laplacian");
// consider frame policy on new image created
Action::applyTargetPosition(comp, outputComp);
......
......@@ -24,15 +24,11 @@
****************************************************************************/
// CamiTK includes
#include "LaplacianRecursiveGaussian.h"
#include <Application.h>
#include <ItkProgressObserver.h>
#include <Property.h>
// Qt includes
#include <QMessageBox>
#include <QString>
#include <QTextStream>
// Itk includes
#include <itkImageToVTKImageFilter.h>
#include <itkVTKImageToImageFilter.h>
......@@ -91,10 +87,8 @@ void LaplacianRecursiveGaussian::process(ImageComponent* comp) {
// ITK filter implementation using templates
vtkSmartPointer<vtkImageData> inputImage = comp->getImageData();
vtkSmartPointer<vtkImageData> outputImage = implementProcess (inputImage);
QString newName;
QTextStream(&newName) << comp->getName() << "_LoG";
ImageComponent* outputComp = new ImageComponent(outputImage, newName);
ImageComponent* outputComp = new ImageComponent(outputImage, comp->getName() + "_LoG");
// consider frame policy on new image created
Action::applyTargetPosition(comp, outputComp);
......
......@@ -26,9 +26,7 @@
#include <Application.h>
#include <ItkProgressObserver.h>
#include <QMessageBox>
#include <QString>
#include <QTextStream>
#include <itkImageToVTKImageFilter.h>
#include <itkVTKImageToImageFilter.h>
#include <itkLaplacianSharpeningImageFilter.h>
......@@ -73,10 +71,7 @@ void LaplacianSharpening::process(ImageComponent* comp) {
// ITK filter implementation using templates
vtkSmartPointer<vtkImageData> inputImage = comp->getImageData();
vtkSmartPointer<vtkImageData> outputImage = implementProcess (inputImage);
QString newName;
QTextStream(&newName) << comp->getName() << "_sharpened";
ImageComponent* outputComp = new ImageComponent(outputImage, newName);
ImageComponent* outputComp = new ImageComponent(outputImage, comp->getName() + "_sharpened");
// consider frame policy on new image created
Action::applyTargetPosition(comp, outputComp);
......
......@@ -28,11 +28,6 @@
#include <ItkProgressObserver.h>
#include <Property.h>
// Qt includes
#include <QMessageBox>
#include <QString>
#include <QTextStream>
// Itk includes
#include <itkImageToVTKImageFilter.h>
#include <itkVTKImageToImageFilter.h>
......@@ -109,10 +104,7 @@ void MeanFilter::process(ImageComponent* comp) {
// ITK filter implementation using templates
vtkSmartPointer<vtkImageData> inputImage = comp->getImageData();
vtkSmartPointer<vtkImageData> outputImage = implementProcess (inputImage);
QString newName;
QTextStream(&newName) << comp->getName() << "_mean";
ImageComponent* outputComp = new ImageComponent(outputImage, newName);
ImageComponent* outputComp = new ImageComponent(outputImage, comp->getName() + "_mean");
// consider frame policy on new image created
Action::applyTargetPosition(comp, outputComp);
......
......@@ -28,11 +28,6 @@
#include <ItkProgressObserver.h>
#include <Property.h>
// Qt includes
#include <QMessageBox>
#include <QString>
#include <QTextStream>
// Itk includes
#include <itkImageToVTKImageFilter.h>
#include <itkVTKImageToImageFilter.h>
......@@ -110,10 +105,8 @@ void MedianFilter::process(ImageComponent* comp) {
// ITK filter implementation using templates
vtkSmartPointer<vtkImageData> inputImage = comp->getImageData();
vtkSmartPointer<vtkImageData> outputImage = implementProcess (inputImage);
QString newName;
QTextStream(&newName) << comp->getName() << "_median";
ImageComponent* outputComp = new ImageComponent(outputImage, newName);
ImageComponent* outputComp = new ImageComponent(outputImage, comp->getName() + "_median");
// consider frame policy on new image created
Action::applyTargetPosition(comp, outputComp);
......
......@@ -28,11 +28,6 @@
#include <ItkProgressObserver.h>
#include <Property.h>
// Qt includes
#include <QMessageBox>
#include <QString>
#include <QTextStream>
// Itk includes
#include <itkImageToVTKImageFilter.h>
#include <itkVTKImageToImageFilter.h>
......@@ -105,10 +100,8 @@ void MorphologicalOperators::process(ImageComponent* comp) {
// ITK filter implementation using templates
vtkSmartPointer<vtkImageData> inputImage = comp->getImageData();
vtkSmartPointer<vtkImageData> outputImage = implementProcess (inputImage);
QString newName;
QTextStream(&newName) << comp->getName() << suffix;
ImageComponent* outputComp = new ImageComponent(outputImage, newName);
ImageComponent* outputComp = new ImageComponent(outputImage, comp->getName() + suffix);
// consider frame policy on new image created
Action::applyTargetPosition(comp, outputComp);
......
......@@ -24,15 +24,11 @@
****************************************************************************/
// CamiTK includes
#include "SobelEdgeDetection.h"
#include <Application.h>
#include <ItkProgressObserver.h>
#include <Property.h>
// Qt includes
#include <QMessageBox>
#include <QString>
#include <QTextStream>
// Itk includes
#include <itkImageToVTKImageFilter.h>
#include <itkVTKImageToImageFilter.h>
......@@ -80,10 +76,7 @@ void SobelEdgeDetection::process(ImageComponent* comp) {
// ITK filter implementation using templates
vtkSmartPointer<vtkImageData> inputImage = comp->getImageData();
vtkSmartPointer<vtkImageData> outputImage = implementProcess (inputImage);
QString newName;
QTextStream(&newName) << comp->getName() << "_edges";
ImageComponent* outputComp = new ImageComponent(outputImage, newName);
ImageComponent* outputComp = new ImageComponent(outputImage, comp->getName() + "_edges");
// consider frame policy on new image created
Action::applyTargetPosition(comp, outputComp);
......
......@@ -28,11 +28,6 @@
#include <ItkProgressObserver.h>
#include <Property.h>
// Qt includes
#include <QMessageBox>
#include <QString>
#include <QTextStream>
// Itk includes
#include <itkImageToVTKImageFilter.h>
#include <itkVTKImageToImageFilter.h>
......@@ -95,10 +90,8 @@ void ManualThreshold::process(ImageComponent* comp) {
// ITK filter implementation using templates
vtkSmartPointer<vtkImageData> inputImage = comp->getImageData();
vtkSmartPointer<vtkImageData> outputImage = implementProcess (inputImage);
QString newName;
QTextStream(&newName) << comp->getName() << "_threshold";
ImageComponent* outputComp = new ImageComponent(outputImage, newName);
ImageComponent* outputComp = new ImageComponent(outputImage, comp->getName() + "_threshold");
// consider frame policy on new image created
Action::applyTargetPosition(comp, outputComp);
......
......@@ -28,11 +28,6 @@
#include <ItkProgressObserver.h>
#include <Property.h>
// Qt includes
#include <QMessageBox>
#include <QString>
#include <QTextStream>
// Itk includes
#include <itkImageToVTKImageFilter.h>
#include <itkVTKImageToImageFilter.h>
......@@ -120,9 +115,7 @@ void OtsuFilter::process(ImageComponent* comp) {
imageThreshold->SetOutValue(outsideValue);
imageThreshold->Update();
outputImage = imageThreshold->GetOutput();
QString newName;
QTextStream(&newName) << comp->getName() << "_otsu";
new ImageComponent(outputImage, newName);
new ImageComponent(outputImage, comp->getName() + "_otsu");
Application::refresh();
*/
......@@ -154,9 +147,7 @@ void OtsuFilter::process(ImageComponent* comp) {
result->SetExtent(extent);
result->DeepCopy(outputImage);
result->Update();
QString newName;
QTextStream(&newName) << comp->getName() << "_otsu";
new ImageComponent(result, newName);
new ImageComponent(result, comp->getName() + "_otsu");
Application::refresh();
*/
......@@ -178,9 +169,7 @@ void OtsuFilter::process(ImageComponent* comp) {
result->SetExtent(extent);
result->DeepCopy(outputImage);
result->Update();
QString newName;
QTextStream(&newName) << comp->getName() << "_otsu";
new ImageComponent(result, newName);
new ImageComponent(result, comp->getName() + "_otsu");
Application::refresh();
*/
......@@ -203,9 +192,7 @@ void OtsuFilter::process(ImageComponent* comp) {
result->SetExtent(extent);
result->DeepCopy(outputImage);
result->Update();
QString newName;
QTextStream(&newName) << comp->getName() << "_otsu";
new ImageComponent(result, newName);
new ImageComponent(result, comp->getName() + "_otsu");
Application::refresh();
*/
......@@ -236,9 +223,7 @@ void OtsuFilter::process(ImageComponent* comp) {
result->Update();
outputImage = NULL;
QString newName;
QTextStream(&newName) << comp->getName() << "_otsu";
new ImageComponent(result, newName);
new ImageComponent(result, comp->getName() + "_otsu");
result = NULL;
Application::refresh();
*/
......@@ -257,9 +242,7 @@ void OtsuFilter::process(ImageComponent* comp) {
vtkSmartPointer<vtkImageData> inputImage = comp->getImageData();
vtkSmartPointer<vtkImageData> outputImage = implementProcess(inputImage);
QString newName;
QTextStream(&newName) << comp->getName() << "_otsu";
ImageComponent* outputComp = new ImageComponent(outputImage, newName);
ImageComponent* outputComp = new ImageComponent(outputImage, comp->getName() + "_otsu");
// consider frame policy on new image created
Action::applyTargetPosition(comp, outputComp);
......
......@@ -24,12 +24,6 @@
****************************************************************************/
#include "RegionGrowing.h"
// includes from Qt
#include <QMessageBox>
#include <QString>
#include <QTextStream>
#include <QVBoxLayout>
// includes from CamiTK
#include <Application.h>
#include <Log.h>
......@@ -141,10 +135,8 @@ void RegionGrowing::process(ImageComponent* comp) {
// ITK filter implementation using templates
vtkSmartPointer<vtkImageData> inputImage = comp->getImageData();
vtkSmartPointer<vtkImageData> outputImage = implementProcess (inputImage);
QString newName;
QTextStream(&newName) << comp->getName() << "_segmented";
ImageComponent* outputComp = new ImageComponent(outputImage, newName);
ImageComponent* outputComp = new ImageComponent(outputImage, comp->getName() + "_segmented");
// consider frame policy on new image created
Action::applyTargetPosition(comp, outputComp);
......
......@@ -22,7 +22,7 @@
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#include <QMessageBox>
#include <QFileDialog>
#include <QList>
#include <QVector3D>
......
......@@ -24,13 +24,12 @@
****************************************************************************/
// -- CamiTK includes
#include <Log.h>
#include <AbortException.h>
#include "DicomDialog.h"
#include "DicomDialogEntry.h"
// Qt include
#include <QMessageBox>
//--------------- Constructor ---------------------------------
DicomDialog::DicomDialog(QList<DicomDialogEntry*> elements): QDialog() {
......@@ -38,8 +37,8 @@ DicomDialog::DicomDialog(QList<DicomDialogEntry*> elements): QDialog() {
ui.setupUi(this);
if (elements.isEmpty()) {
QMessageBox::critical(this, tr("Error"), tr("No DICOM image files found"));
return;
CAMITK_ERROR("No DICOM image files found");
throw camitk::AbortException("No DICOM image files found.");;
}
// set table size
......@@ -48,7 +47,7 @@ DicomDialog::DicomDialog(QList<DicomDialogEntry*> elements): QDialog() {
int row = 0;
int column = 0;
foreach(DicomDialogEntry * item, dicomDialogEntries) {
foreach (DicomDialogEntry* item, dicomDialogEntries) {
column = 0;
QTableWidgetItem* selectionItem = new QTableWidgetItem("");
selectionItem->setCheckState(Qt::Unchecked);
......
......@@ -33,9 +33,7 @@
#include <itkImageFileWriter.h>