Skip to content

Commit

Permalink
Merge pull request #122 from rmukh/boost_fix
Browse files Browse the repository at this point in the history
Fix warnings and error messages
  • Loading branch information
yrathi authored Jan 17, 2020
2 parents 449f258 + c7093bf commit 2c144a3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
9 changes: 6 additions & 3 deletions ukf/tractography.cc
Original file line number Diff line number Diff line change
Expand Up @@ -363,15 +363,17 @@ bool Tractography::LoadFiles(const std::string& data_file,
void Tractography::Init(std::vector<SeedPointInfo>& seed_infos)
{
if (! (_signal_data)) {
itkGenericExceptionMacro(<< "No signal data!");
std::cout << "No signal data!";
throw;
}

int signal_dim = _signal_data->GetSignalDimension();

stdVec_t seeds;
if (! (_labels.size() > 0))
{
itkGenericExceptionMacro(<< "No label data!");
std::cout << "No label data!";
throw;
}

if(!_ext_seeds.empty())
Expand Down Expand Up @@ -403,7 +405,8 @@ void Tractography::Init(std::vector<SeedPointInfo>& 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.
Expand Down
10 changes: 5 additions & 5 deletions ukf/vtk_writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ ::Write(const std::string& file_name,
int state_dim = fibers[0].state[0].size();
vtkSmartPointer<vtkFloatArray> stateArray = vtkSmartPointer<vtkFloatArray>::New();
stateArray->SetNumberOfComponents(state_dim);
stateArray->Allocate(num_points * state_dim);
stateArray->Allocate(num_points);
stateArray->SetName("state");

float *tmpArray = new float[state_dim];
Expand All @@ -497,19 +497,19 @@ ::Write(const std::string& file_name,
}
}
int idx = pointData->AddArray(stateArray);
pointData->SetActiveAttribute(idx,vtkDataSetAttributes::VECTORS);
pointData->SetActiveAttribute(idx,vtkDataSetAttributes::SCALARS);
delete [] tmpArray;
}

if(fibers[0].covariance.size() > 0)
{
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<vtkFloatArray> covarianceArray = vtkSmartPointer<vtkFloatArray>::New();
covarianceArray->SetNumberOfComponents(cov_dim);
covarianceArray->Allocate(num_points * cov_dim);
covarianceArray->Allocate(num_points);
covarianceArray->SetName("covariance");

float *tmpArray = new float[cov_dim];
Expand All @@ -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;
}

Expand Down

0 comments on commit 2c144a3

Please sign in to comment.