Skip to content

Commit

Permalink
loaddata returns tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
eidelen committed Oct 12, 2024
1 parent c6b056d commit b032589
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dicom2mesh/inc/dicom2mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Dicom2Mesh
static void showVersionText();

private:
bool loadInputData( vtkSmartPointer<vtkImageData>& volume, vtkSmartPointer<vtkPolyData>& mesh3d );
std::tuple<bool, vtkSmartPointer<vtkPolyData>, vtkSmartPointer<vtkImageData>> loadInputData();
std::string getParametersAsString(const Dicom2MeshParameters& params) const;
static bool parseVolumeRenderingColorEntry( const std::string& text, VolumeRenderingColoringEntry& colorEntry );
static std::vector<std::string> parseCommaSeparatedStr(const std::string& text);
Expand Down
14 changes: 7 additions & 7 deletions dicom2mesh/src/dicom2mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,9 @@ int Dicom2Mesh::doMesh()
std::cout << std::endl << getParametersAsString(m_params) << std::endl;
//******************************//

//******** Read DICOM *********//
vtkSmartPointer<vtkPolyData> mesh;
vtkSmartPointer<vtkImageData> volume;
if( !loadInputData( volume, mesh) )
//******** Read DICOM or Mesh *********//
auto[loadDataOk, mesh, volume] = loadInputData();
if( !loadDataOk )
return -1;
//******************************//

Expand Down Expand Up @@ -458,9 +457,10 @@ void Dicom2Mesh::showVersionText()
std::cout << "dicom2Mesh version 0.8.0, https://github.com/eidelen/DicomToMesh" << std::endl;
}


bool Dicom2Mesh::loadInputData( vtkSmartPointer<vtkImageData>& volume, vtkSmartPointer<vtkPolyData>& mesh3d )
std::tuple<bool, vtkSmartPointer<vtkPolyData>, vtkSmartPointer<vtkImageData>> Dicom2Mesh::loadInputData()
{
vtkSmartPointer<vtkPolyData> mesh3d;
vtkSmartPointer<vtkImageData> volume;
bool result = false;

bool loadObj = false; bool loadStl = false; bool loadPly = false;
Expand Down Expand Up @@ -526,7 +526,7 @@ bool Dicom2Mesh::loadInputData( vtkSmartPointer<vtkImageData>& volume, vtkSmartP
}
}

return result;
return {result, mesh3d, volume};
}

std::string Dicom2Mesh::getParametersAsString(const Dicom2MeshParameters& params) const
Expand Down
1 change: 0 additions & 1 deletion dicom2mesh/test/t_d2m.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ TEST(D2M, ImportSimpleMesh)
ASSERT_GT(filesize(exportFilePath), 0);
ASSERT_TRUE(std::filesystem::exists(std::filesystem::path(exportFilePath)));


remove(fn.c_str());
remove(exportFilePath.c_str());
}
Expand Down

0 comments on commit b032589

Please sign in to comment.