Skip to content

Commit

Permalink
ENH: invert button connected for the watershed mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasRannou committed Jun 15, 2011
1 parent 4025f9b commit f36f62c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Code/GUI/lib/TraceEditing/QGoMeshWaterShedAlgo.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ ApplyAlgo(GoImageProcessor* iImages, std::string iChannel, bool iIsInvertedOn)
vtkPolyData* temp_output =
this->ApplyWaterShedFilter< unsigned char >(
CenterVect, //cente
iImages->getImageITK< unsigned char, 3>(iChannel)); //input raw image
iImages->getImageITK< unsigned char, 3>(iChannel, iIsInvertedOn)); //input raw image

std::cout << "ApplyWaterShedFilter called" << std::endl;

Expand Down
23 changes: 20 additions & 3 deletions Code/IO/GoImage/GoImageProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
// external library include
// VTK
#include "vtkSmartPointer.h"
// ITK
#include "itkInvertIntensityImageFilter.h"
// BOOST
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/member.hpp>
Expand Down Expand Up @@ -325,16 +327,31 @@ class QGOIO_EXPORT GoImageProcessor
**/
template< class PixelType, const unsigned int VImageDimension >
typename itk::Image< PixelType, VImageDimension >::Pointer
getImageITK(std::string iIndex)
getImageITK(std::string iIndex, bool iIsInverted = false)
{
GoMegaImageStructureMultiIndexContainer::index<Name>::type::iterator it =
m_MegaImageContainer.get< Name >().find(iIndex);

if(it!=m_MegaImageContainer.get< Name >().end())
assert(it!=m_MegaImageContainer.get< Name >().end());

if(iIsInverted)
{
//get image and invert it
typedef itk::Image<PixelType, VImageDimension> ImageType;
typedef itk::InvertIntensityImageFilter <ImageType> InvertFilterType;
typename InvertFilterType::Pointer invertFilter = InvertFilterType::New();
invertFilter->SetInput( it->Convert2ITK<PixelType, VImageDimension>() );
invertFilter->Update();

typename ImageType::Pointer itkImage = invertFilter->GetOutput();
itkImage->DisconnectPipeline();

return itkImage;
}
else
{
return it->Convert2ITK<PixelType, VImageDimension>();
}

return NULL;
}

Expand Down

0 comments on commit f36f62c

Please sign in to comment.