From c7093bf486f113d3c45efd68990c913ca853974d Mon Sep 17 00:00:00 2001 From: Rinat Mukhometzianov Date: Wed, 10 Jul 2019 21:55:55 -0400 Subject: [PATCH] Fix warnings and error messages --- ukf/tractography.cc | 9 ++++++--- ukf/vtk_writer.cc | 10 +++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ukf/tractography.cc b/ukf/tractography.cc index 50fd58e..9332019 100644 --- a/ukf/tractography.cc +++ b/ukf/tractography.cc @@ -363,7 +363,8 @@ bool Tractography::LoadFiles(const std::string& data_file, void Tractography::Init(std::vector& seed_infos) { if (! (_signal_data)) { - itkGenericExceptionMacro(<< "No signal data!"); + std::cout << "No signal data!"; + throw; } int signal_dim = _signal_data->GetSignalDimension(); @@ -371,7 +372,8 @@ void Tractography::Init(std::vector& seed_infos) stdVec_t seeds; if (! (_labels.size() > 0)) { - itkGenericExceptionMacro(<< "No label data!"); + std::cout << "No label data!"; + throw; } if(!_ext_seeds.empty()) @@ -403,7 +405,8 @@ void Tractography::Init(std::vector& seed_infos) } if (! (seeds.size() > 0)) { - itkGenericExceptionMacro(<< "No matching label ROI seeds found! Please verify label selection."); + std::cout << "No matching label ROI seeds found! Please verify label selection."; + throw; } // Determinism. diff --git a/ukf/vtk_writer.cc b/ukf/vtk_writer.cc index e93d834..be2f02d 100644 --- a/ukf/vtk_writer.cc +++ b/ukf/vtk_writer.cc @@ -478,7 +478,7 @@ ::Write(const std::string& file_name, int state_dim = fibers[0].state[0].size(); vtkSmartPointer stateArray = vtkSmartPointer::New(); stateArray->SetNumberOfComponents(state_dim); - stateArray->Allocate(num_points * state_dim); + stateArray->Allocate(num_points); stateArray->SetName("state"); float *tmpArray = new float[state_dim]; @@ -497,7 +497,7 @@ ::Write(const std::string& file_name, } } int idx = pointData->AddArray(stateArray); - pointData->SetActiveAttribute(idx,vtkDataSetAttributes::VECTORS); + pointData->SetActiveAttribute(idx,vtkDataSetAttributes::SCALARS); delete [] tmpArray; } @@ -505,11 +505,11 @@ ::Write(const std::string& file_name, { int state_dim = fibers[0].state[0].size(); - int cov_dim = state_dim * (state_dim + 1) / 2; + int cov_dim = (state_dim * (state_dim + 1)) / 2; vtkSmartPointer covarianceArray = vtkSmartPointer::New(); covarianceArray->SetNumberOfComponents(cov_dim); - covarianceArray->Allocate(num_points * cov_dim); + covarianceArray->Allocate(num_points); covarianceArray->SetName("covariance"); float *tmpArray = new float[cov_dim]; @@ -532,7 +532,7 @@ ::Write(const std::string& file_name, } } int idx = pointData->AddArray(covarianceArray); - pointData->SetActiveAttribute(idx,vtkDataSetAttributes::VECTORS); + pointData->SetActiveAttribute(idx,vtkDataSetAttributes::SCALARS); delete [] tmpArray; }