Skip to content

Commit

Permalink
Merge pull request #16 from thewtex/get-output
Browse files Browse the repository at this point in the history
BUG: Expose OutputMeshType * GetOutput(index)
  • Loading branch information
thewtex authored Apr 14, 2022
2 parents 4427e06 + a5b1d17 commit f5ba3f4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
11 changes: 9 additions & 2 deletions include/itkCleaverImageToMeshFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class CleaverImageToMeshFilter : public ImageToMeshFilter<TInputImage, TOutputMe
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;

using DataObjectPointerArraySizeType = typename Superclass::Superclass::DataObjectPointerArraySizeType;

/** Run-time type information. */
itkTypeMacro(CleaverImageToMeshFilter, ImageToMeshFilter);

Expand Down Expand Up @@ -86,14 +88,19 @@ class CleaverImageToMeshFilter : public ImageToMeshFilter<TInputImage, TOutputMe
itkSetMacro(FeatureScaling, double);
itkGetConstMacro(FeatureScaling, double);

/** Sizing field padding. Adds a volume buffer around the data. Useful when volumes intersect near the boundary. */
/** Sizing field padding. Adds a volume buffer around the data. Useful when volumes intersect near the boundary. */
itkSetMacro(Padding, int);
itkGetConstMacro(Padding, int);

itkSetMacro(Alpha, double);
itkGetConstMacro(Alpha, double);

using Superclass::Superclass::GetOutput;
/** Get the outptu meshes. Output 0 is the tetrahedral mesh. Output 1 is the
* interface triangle mesh. */
OutputMeshType *
GetOutput(DataObjectPointerArraySizeType index);
const OutputMeshType *
GetOutput(DataObjectPointerArraySizeType index) const;

protected:
CleaverImageToMeshFilter();
Expand Down
24 changes: 20 additions & 4 deletions include/itkCleaverImageToMeshFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ segmentationToIndicatorFunctions(const TImage * image, double sigma) {
auto caster = CasterType::New();
caster->SetInput(image);
caster->Update();

//determine the number of labels in the segmentations
using ImageCalculatorFilterType = itk::MinimumMaximumImageCalculator<FloatImageType>;
auto imageCalculatorFilter
Expand Down Expand Up @@ -180,7 +180,7 @@ imagesToCleaverFloatFields(std::vector<const TImage *> images, double sigma)
{
std::vector<cleaver::AbstractScalarField*> fields;
size_t num = 0;
for (auto image : images)
for (auto image : images)
{
using ImageType = TImage;
using FloatImageType = itk::Image<float, ImageType::ImageDimension>;
Expand Down Expand Up @@ -321,6 +321,22 @@ CleaverImageToMeshFilter<TInputImage, TOutputMesh>
}


template <typename TInputImage, typename TOutputMesh>
auto
CleaverImageToMeshFilter<TInputImage, TOutputMesh>
::GetOutput(DataObjectPointerArraySizeType index) -> OutputMeshType *
{
return static_cast<OutputMeshType *>(this->ProcessObject::GetOutput(index));
}

template <typename TInputImage, typename TOutputMesh>
auto
CleaverImageToMeshFilter<TInputImage, TOutputMesh>
::GetOutput(DataObjectPointerArraySizeType index) const -> const OutputMeshType *
{
return static_cast<const OutputMeshType *>(this->ProcessObject::GetOutput(index));
}

template <typename TInputImage, typename TOutputMesh>
void
CleaverImageToMeshFilter<TInputImage, TOutputMesh>
Expand Down Expand Up @@ -482,7 +498,7 @@ CleaverImageToMeshFilter<TInputImage, TOutputMesh>
}
}

OutputMeshType * tetOutput = this->GetOutput(0);
OutputMeshType * tetOutput = this->GetOutput(0);
using CellType = typename OutputMeshType::CellType;

for (size_t ii = 0; ii < prunedVerts.size(); ii++)
Expand Down Expand Up @@ -526,7 +542,7 @@ CleaverImageToMeshFilter<TInputImage, TOutputMesh>
tetOutput->SetCellData(outputCellData);


OutputMeshType * triangleOutput = this->GetOutput(1);
OutputMeshType * triangleOutput = this->GetOutput(1);

std::vector<size_t> interfaces;
std::vector<size_t> triangleCellData;
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

setup(
name='itk-cleaver',
version='1.1.0',
version='1.1.1',
author='SCI Institute',
author_email='[email protected]',
packages=['itk'],
Expand Down

0 comments on commit f5ba3f4

Please sign in to comment.