Commit 71b81769 authored by Emmanuel Promayon's avatar Emmanuel Promayon
Browse files

FIXED else branch should be separated



Result after adding the --break-closing-brackets
to astyle
Signed-off-by: Emmanuel Promayon's avatarEmmanuel Promayon <Emmanuel.Promayon@imag.fr>
parent 75440a67
......@@ -225,7 +225,8 @@ vtkSmartPointer<vtkImageData> AnisotropicDiffusion::itkProcessGradientAnisotropi
observer->Reset();
resultImage = itkToVtkOrgFilter->GetOutput();
} else {
}
else {
itkToVtkFloatFilter->SetInput(filter->GetOutput());
itkToVtkFloatFilter->AddObserver(itk::ProgressEvent(), observer);
itkToVtkFloatFilter->Update();
......@@ -321,7 +322,8 @@ vtkSmartPointer<vtkImageData> AnisotropicDiffusion::itkProcessCurvatureAnisotrop
observer->Reset();
resultImage = itkToVtkOrgFilter->GetOutput();
} else {
}
else {
itkToVtkFloatFilter->SetInput(filter->GetOutput());
itkToVtkFloatFilter->AddObserver(itk::ProgressEvent(), observer);
itkToVtkFloatFilter->Update();
......
......@@ -187,7 +187,8 @@ vtkSmartPointer<vtkImageData> CannyEdgeDetection::itkProcess(vtkSmartPointer<vtk
observer->Reset();
// --------------------- Create and return a copy (the filters will be deleted)--
resultImage = itkToVtkFilter2->GetOutput();
} else {
}
else {
// From ITK to VTK
itkToVtkFilter->SetInput(cannyFilter->GetOutput());
itkToVtkFilter->AddObserver(itk::ProgressEvent(), observer);
......
......@@ -197,7 +197,8 @@ vtkSmartPointer<vtkImageData> Derivative::itkProcess(vtkSmartPointer<vtkImageDat
observer->Reset();
resultImage = itkToVtkOrgFilter->GetOutput();
} else {
}
else {
itkToVtkFloatFilter->SetInput(derivativeFilter->GetOutput());
itkToVtkFloatFilter->AddObserver(itk::ProgressEvent(), observer);
itkToVtkFloatFilter->Update();
......
......@@ -253,7 +253,8 @@ vtkSmartPointer<vtkImageData> GaussianFilter::itkProcessIIRGaussian(vtkSmartPoin
observerX->SetStartValue( 0.0);
observerY->SetStartValue(50.0);
} else { // dim == 3
}
else { // dim == 3
observerZ = ItkProgressObserver::New();
observerX->SetCoef(33.3);
......
......@@ -172,7 +172,8 @@ vtkSmartPointer<vtkImageData> Laplacian::itkProcess(vtkSmartPointer<vtkImageData
observer->Reset();
resultImage = itkToVtkOrgFilter->GetOutput();
} else {
}
else {
itkToVtkFloatFilter->SetInput(laplacianFilter->GetOutput());
itkToVtkFloatFilter->AddObserver(itk::ProgressEvent(), observer);
itkToVtkFloatFilter->Update();
......
......@@ -167,7 +167,8 @@ vtkSmartPointer<vtkImageData> LaplacianRecursiveGaussian::itkProcess(vtkSmartPoi
observer->Reset();
resultImage = itkToVtkOrgFilter->GetOutput();
} else {
}
else {
itkToVtkFloatFilter->SetInput(recursiveGaussianFilter->GetOutput());
itkToVtkFloatFilter->AddObserver(itk::ProgressEvent(), observer);
itkToVtkFloatFilter->Update();
......
......@@ -165,7 +165,8 @@ vtkSmartPointer<vtkImageData> SobelEdgeDetection::itkProcess(vtkSmartPointer<vtk
observer->Reset();
resultImage = itkToVtkFilter2->GetOutput();
} else {
}
else {
// From ITK to VTK
itkToVtkFilter->SetInput(sobelFilter->GetOutput());
itkToVtkFilter->AddObserver(itk::ProgressEvent(), observer );
......
......@@ -212,7 +212,8 @@ vtkSmartPointer<vtkImageData> RegionGrowing::itkProcess(vtkSmartPointer<vtkImage
observer->Reset();
connectedThreshold->SetInput(smoothingFilter->GetOutput());
} else {
}
else {
connectedThreshold->SetInput(castFilter->GetOutput());
}
......
......@@ -69,11 +69,13 @@ DicomComponent::DicomComponent(DicomSerie* dicomSerie) throw(AbortException) : I
CAMITK_ERROR("DicomSerieComponent", "DicomSerieComponent", "IPPSorter sorting failed. Try to adjust Z spacing tolerance.")
files = stdFileNames;
zSpacing = DicomParser::getZSpacing(files);
} else {
}
else {
files = ippSorter.GetFilenames();
zSpacing = ippSorter.GetZSpacing();
}
} else {
}
else {
files = stdFileNames;
zSpacing = DicomParser::getZSpacing(files);
}
......
......@@ -84,7 +84,8 @@ Component * DicomComponentExtension::open(const QString & path) throw (AbortExce
(serie->getSerieName() == entry->getSerieName()) ) {
lastOpenedComponent = new DicomComponent(serie);
break;
} else
}
else
delete serie;
}
......
......@@ -62,9 +62,11 @@ QList<DicomSerie*> DicomParser::parseDirectory(const QString & directory) {
if( it != ttv.end() ) {
CAMITK_DEBUG("DicomParser", "parseDirectory", file +" is a DICOM image file");
imageFileNames.push_back(file);
} else
}
else
CAMITK_DEBUG("DicomParser", "parseDirectory", file +" is a DICOM file WITHOUT PixelData information");
} else
}
else
CAMITK_DEBUG("DicomParser", "parseDirectory", file +" is not a valid DICOM file");
}
......
......@@ -92,7 +92,8 @@ vtkSmartPointer<vtkImageData> DicomItkComponent::readVolume(const QString direct
// Read the chosen image
try {
orientImage->Update();
} catch (itk::ExceptionObject & e) {
}
catch (itk::ExceptionObject & e) {
cout << e.what();
return NULL;
}
......
......@@ -127,7 +127,8 @@ Component * DicomItkComponentExtension::open(const QString & directoryName) thro
}
}
} catch(AbortException e) {
}
catch(AbortException e) {
QMessageBox * msg = new QMessageBox();
msg->setText(QString(e.what()));
msg->show();
......
......@@ -56,10 +56,12 @@ void ItkImageComponent::createComponent(const QString & filename) {
setImageData(img, false);
// use file basename as default name
setName(QFileInfo(filename).baseName());
} else {
}
else {
throw (AbortException("Could not open file\n"));
}
} else {
}
else {
throw (AbortException("No filename found\n"));
}
......@@ -112,7 +114,8 @@ vtkSmartPointer<vtkImageData> ItkImageComponent::readVolume(const QString& filen
newImage->DeepCopy(oldPointer);
// set the original slices. Other orientation are build when/if required only.
} catch ( itk::ExceptionObject & err ) {
}
catch ( itk::ExceptionObject & err ) {
std::cerr << "ExceptionObject caught !" << std::endl;
std::cerr << err << std::endl;
return NULL;
......
......@@ -70,7 +70,8 @@ Component * ItkImageComponentExtension::open(const QString & fileName) throw (Ab
ItkImageComponent * res = NULL;
try {
res = new ItkImageComponent(fileName);
} catch (AbortException e) {
}
catch (AbortException e) {
throw e;
}
return res;
......@@ -107,7 +108,8 @@ bool ItkImageComponentExtension::save(Component * c) const {
if (dim == 2) {
typedef itk::Image<char, 2> ImageType;
succeed = ItkImageComponentExtension::saveImage<ImageType>(img);
} else { // if dim == 3
}
else { // if dim == 3
typedef itk::Image<char, 3> ImageType;
succeed = ItkImageComponentExtension::saveImage<ImageType>(img);
}
......@@ -119,7 +121,8 @@ bool ItkImageComponentExtension::save(Component * c) const {
if (dim == 2) {
typedef itk::Image<unsigned char, 2> ImageType;
succeed = ItkImageComponentExtension::saveImage<ImageType>(img);
} else { // if dim == 3
}
else { // if dim == 3
typedef itk::Image<unsigned char, 3> ImageType;
succeed = ItkImageComponentExtension::saveImage<ImageType>(img);
}
......@@ -131,7 +134,8 @@ bool ItkImageComponentExtension::save(Component * c) const {
if (dim == 2) {
typedef itk::Image<signed char, 2> ImageType;
succeed = ItkImageComponentExtension::saveImage<ImageType>(img);
} else { // if dim == 3
}
else { // if dim == 3
typedef itk::Image<signed char, 3> ImageType;
succeed = ItkImageComponentExtension::saveImage<ImageType>(img);
}
......@@ -143,7 +147,8 @@ bool ItkImageComponentExtension::save(Component * c) const {
if (dim == 2) {
typedef itk::Image<short, 2> ImageType;
succeed = ItkImageComponentExtension::saveImage<ImageType>(img);
} else { // if dim == 3
}
else { // if dim == 3
typedef itk::Image<short, 3> ImageType;
succeed = ItkImageComponentExtension::saveImage<ImageType>(img);
}
......@@ -155,7 +160,8 @@ bool ItkImageComponentExtension::save(Component * c) const {
if (dim == 2) {
typedef itk::Image<unsigned short, 2> ImageType;
succeed = ItkImageComponentExtension::saveImage<ImageType>(img);
} else { // if dim == 3
}
else { // if dim == 3
typedef itk::Image<unsigned short, 3> ImageType;
succeed = ItkImageComponentExtension::saveImage<ImageType>(img);
}
......@@ -167,7 +173,8 @@ bool ItkImageComponentExtension::save(Component * c) const {
if (dim == 2) {
typedef itk::Image<int, 2> ImageType;
succeed = ItkImageComponentExtension::saveImage<ImageType>(img);
} else { // if dim == 3
}
else { // if dim == 3
typedef itk::Image<int, 3> ImageType;
succeed = ItkImageComponentExtension::saveImage<ImageType>(img);
}
......@@ -179,7 +186,8 @@ bool ItkImageComponentExtension::save(Component * c) const {
if (dim == 2) {
typedef itk::Image<unsigned int, 2> ImageType;
succeed = ItkImageComponentExtension::saveImage<ImageType>(img);
} else { // if dim == 3
}
else { // if dim == 3
typedef itk::Image<unsigned int, 3> ImageType;
succeed = ItkImageComponentExtension::saveImage<ImageType>(img);
}
......@@ -191,7 +199,8 @@ bool ItkImageComponentExtension::save(Component * c) const {
if (dim == 2) {
typedef itk::Image<long, 2> ImageType;
succeed = ItkImageComponentExtension::saveImage<ImageType>(img);
} else { // if dim == 3
}
else { // if dim == 3
typedef itk::Image<long, 3> ImageType;
succeed = ItkImageComponentExtension::saveImage<ImageType>(img);
}
......@@ -203,7 +212,8 @@ bool ItkImageComponentExtension::save(Component * c) const {
if (dim == 2) {
typedef itk::Image<unsigned long, 2> ImageType;
succeed = ItkImageComponentExtension::saveImage<ImageType>(img);
} else { // if dim == 3
}
else { // if dim == 3
typedef itk::Image<unsigned long, 3> ImageType;
succeed = ItkImageComponentExtension::saveImage<ImageType>(img);
}
......@@ -215,7 +225,8 @@ bool ItkImageComponentExtension::save(Component * c) const {
if (dim == 2) {
typedef itk::Image<float, 2> ImageType;
succeed = ItkImageComponentExtension::saveImage<ImageType>(img);
} else { // if dim == 3
}
else { // if dim == 3
typedef itk::Image<float, 3> ImageType;
succeed = ItkImageComponentExtension::saveImage<ImageType>(img);
}
......@@ -227,7 +238,8 @@ bool ItkImageComponentExtension::save(Component * c) const {
if (dim == 2) {
typedef itk::Image<double, 2> ImageType;
succeed = ItkImageComponentExtension::saveImage<ImageType>(img);
} else { // if dim == 3
}
else { // if dim == 3
typedef itk::Image<double, 3> ImageType;
succeed = ItkImageComponentExtension::saveImage<ImageType>(img);
}
......@@ -264,7 +276,8 @@ template<class ImageType> bool ItkImageComponentExtension::saveImage(ImageCompon
try {
writer->Update();
} catch (itk::ExceptionObject & err ) {
}
catch (itk::ExceptionObject & err ) {
QMessageBox::warning(NULL,"Saving Error", "Problem while saving to file:<br/>" + filename +"<br/>ITK Exception:<br/>"+ err.what());
return false;
}
......
......@@ -263,7 +263,8 @@ void GenerateModel::saveMMLFiles( QString baseFilename ) {
pmlofs.close();
Application::open( mmlFilename );
} else
}
else
QMessageBox::warning(NULL,"Generating Error", "Problem while generating the model<br/>Sofa Simulator not supported");
}
......@@ -39,7 +39,8 @@ QWidget* SimulationDialog::getWidget() {
myWidget = input->getMonitoringGuiManager()->getDialog();
// show the widget
myWidget->show();
} else {
}
else {
CAMITK_ERROR("SimulationDialog", "getWidget", "MMLComponent not valid: no simulation tab can be shown");
}
......
......@@ -105,14 +105,16 @@ QWidget * CreateSC::getWidget() {
QString number = QString::number(numAsStr.toInt() + 1);
number = number.rightJustified(numAsStr.length(), '0');
selectionName.replace(start, numAsStr.length(), number);
} else {
}
else {
// no number
start = selectionName.lastIndexOf('.');
if (start != -1) {
// has a . somewhere, e.g. it has an extension
selectionName.insert(start, '1');
} else {
}
else {
// no extension, just tack it on to the end
selectionName += '1';
}
......@@ -207,7 +209,8 @@ bool CreateSC::computeBoundsOfSelection(PMLComponent * pmlComponent, QString sel
if (selectionNode->GetFieldType() == vtkSelectionNode::POINT) {
computeBoundsOfPointIds(pmlComponent, indices, bounds);
return true;
} else if (selectionNode->GetFieldType() == vtkSelectionNode::CELL) {
}
else if (selectionNode->GetFieldType() == vtkSelectionNode::CELL) {
computeBoundsOfCellIds(pmlComponent, vtkIdTypeArray::SafeDownCast(selectionNode->GetSelectionList()), bounds);
return true;
}
......@@ -240,7 +243,8 @@ void CreateSC::updateCorners(PMLComponent * pmlComponent) {
boundsInitialized = boundsInitialized || cellBoundsIsNotEmpty;
if (cellBoundsIsNotEmpty)
mergeBounds(cellBounds, bounds);
} else if (usePickingSelection) {
}
else if (usePickingSelection) {
// get the point selection
boundsInitialized = computeBoundsOfSelection(pmlComponent, "Picked Selection", bounds);
}
......
......@@ -136,7 +136,8 @@ QTreeWidgetItem * PMLExplorerWidget::buildMultiComponentTreeWidgetItem ( MultiCo
for ( unsigned int i = 0; i < inputMC->getNumberOfSubComponents(); i++ ) {
if ( MultiComponent * mc = dynamic_cast<MultiComponent *> ( inputMC->getSubComponent ( i ) ) ) {
buildMultiComponentTreeWidgetItem ( mc, mcItem );
} else if ( StructuralComponent * sc = dynamic_cast<StructuralComponent *> ( inputMC->getSubComponent ( i ) ) ) {
}
else if ( StructuralComponent * sc = dynamic_cast<StructuralComponent *> ( inputMC->getSubComponent ( i ) ) ) {
buildStructuralComponentTreeWidgetItem ( sc, mcItem );
}
}
......@@ -157,7 +158,8 @@ QTreeWidgetItem * PMLExplorerWidget::buildStructuralComponentTreeWidgetItem ( St
for ( unsigned int i = 0; i < sc->getNumberOfStructures(); i++ ) {
if ( Atom * a = dynamic_cast<Atom *> ( sc->getStructure ( i ) ) ) {
buildAtomTreeWidgetItem ( a, scItem );
} else if ( Cell * c = dynamic_cast<Cell *> ( sc->getStructure ( i ) ) ) {
}
else if ( Cell * c = dynamic_cast<Cell *> ( sc->getStructure ( i ) ) ) {
buildCellTreeWidgetItem ( c, scItem );
}
}
......@@ -224,14 +226,17 @@ void PMLExplorerWidget::selectItems() {
pmlComponent->selectAtom ( atomSelected );
// create the corresponding QObject
updateProperty ( item );
} else if ( widgetComponentMap.contains ( item ) ) {
}
else if ( widgetComponentMap.contains ( item ) ) {
Component * comp = widgetComponentMap.value ( item );
if ( Cell * cellSelected = dynamic_cast<Cell *> ( comp ) ) { // Is it a cell ?
pmlComponent->selectCell ( cellSelected, showAtomGlyph );
} else if ( MultiComponent * mc = dynamic_cast<MultiComponent *> ( comp ) ) { // Is it a MC ?
}
else if ( MultiComponent * mc = dynamic_cast<MultiComponent *> ( comp ) ) { // Is it a MC ?
pmlComponent->selectMC ( mc, showAtomGlyph );
} else if ( StructuralComponent * sc = dynamic_cast<StructuralComponent *> ( comp ) ) { // Is it a SC ?
}
else if ( StructuralComponent * sc = dynamic_cast<StructuralComponent *> ( comp ) ) { // Is it a SC ?
pmlComponent->selectSC ( sc, showAtomGlyph );
}
......@@ -331,25 +336,30 @@ void PMLExplorerWidget::updateProperty ( QTreeWidgetItem * item ) {
itemProperties = createAtomPropertyList ( a );
atomPropertiesMap.insert ( a,itemProperties );
}
} else if ( widgetComponentMap.contains ( item ) ) {
}
else if ( widgetComponentMap.contains ( item ) ) {
Component * comp = widgetComponentMap.value ( item );
// cell properties
if ( Cell * c = dynamic_cast<Cell*> ( comp ) ) {
itemProperties = createCellPropertyList ( c );
} else if ( StructuralComponent * sc = dynamic_cast<StructuralComponent*> ( comp ) ) {
}
else if ( StructuralComponent * sc = dynamic_cast<StructuralComponent*> ( comp ) ) {
itemProperties = createSCPropertyList ( sc );
} else if ( MultiComponent *mc = dynamic_cast<MultiComponent*> ( comp ) ) {
}
else if ( MultiComponent *mc = dynamic_cast<MultiComponent*> ( comp ) ) {
itemProperties = createMCPropertyList ( mc );
}
// insert the new property list in the map
widgetPropertiesMap.insert ( item, itemProperties );
} else if ( item == physicalModelItem ) {
}
else if ( item == physicalModelItem ) {
// the component has already set all the dynamic properties
itemProperties = pmlComponent;
} else {
}
else {
editedItem = NULL;
}
}
......@@ -380,12 +390,14 @@ void PMLExplorerWidget::createNewProperty() {
// update object controller
objectController->setObject ( NULL );
objectController->setObject ( pmlComponent );
} else {
}
else {
QObject * editedObject;
if ( Atom * a = widgetAtomMap.value ( editedItem ) ) {
editedObject = atomPropertiesMap.value ( a );
} else if ( widgetComponentMap.contains ( editedItem ) ) {
}
else if ( widgetComponentMap.contains ( editedItem ) ) {
editedObject = widgetPropertiesMap.value ( editedItem );
}
......@@ -569,7 +581,8 @@ void PMLExplorerWidget::propertyChanged() {
if ( editedItem == physicalModelItem ) {
// in the case of the physicalModelItem, nothing to do, this will be taken into account by the property explorer of the component, just refres
pmlComponent->refresh();
} else {
}
else {
if ( Atom * a = widgetAtomMap.value ( editedItem ) ) {
QObject * editedObject = atomPropertiesMap.value ( a );
......@@ -599,7 +612,8 @@ void PMLExplorerWidget::propertyChanged() {
// just in case the position was changed, refresh the whole scene
pmlComponent->refreshDisplay();
} else if ( widgetComponentMap.contains ( editedItem ) ) {
}
else if ( widgetComponentMap.contains ( editedItem ) ) {
QObject * editedObject = widgetPropertiesMap.value ( editedItem );
CamiTKPropertyList *propList = dynamic_cast<CamiTKPropertyList *> ( editedObject );
......@@ -617,7 +631,8 @@ void PMLExplorerWidget::propertyChanged() {
c->getProperties()->set ( propName.toStdString(), value.toStdString() );
}
}
} else {
}
else {
comp->setName ( name.toStdString() );
// all other properties
for ( unsigned int i=0; i<propList->getNumberOfProperties(); i++ ) {
......
......@@ -84,7 +84,8 @@ void testActivation(std::string imlFile, double dt, std::string outcsv = "") {
if (l->getDirection().isToward()) {
std::cout << "dir toward Atom#" << l->getDirection().getToward() << ", ";
} else {
}
else {
std::cout << "dir=(";
// x
......@@ -124,7 +125,8 @@ void testActivation(std::string imlFile, double dt, std::string outcsv = "") {
if (outcsv != "") {
outStream << l->getValue(t) << " ";
}
} else {
}
else {
if (outcsv != "") {
outStream << 0.0 << " ";
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment