18 #ifndef __itkMeshFromImageImageFilter_h    19 #define __itkMeshFromImageImageFilter_h    21 #include "vtkPoints.h"    22 #include "vtkPolyData.h"    23 #include "vtkCellArray.h"    24 #include "vtkPolyDataWriter.h"    25 #include "vtkDoubleArray.h"    26 #include "vtkUnsignedCharArray.h"    27 #include "vtkPointData.h"    28 #include "vtkCellData.h"    29 #include "vtkTypeTraits.h"    31 #include "vtkSmartPointer.h"    34 #include "itkImageSource.h"    48 template < 
class TInputImage, 
class TOutputMesh=vtkPolyData>
    66   static const unsigned int OrientationDimension = 3;
    99   itkSetMacro(ColorScheme, ColorSchemeType);
   100   itkGetMacro(ColorScheme, ColorSchemeType);
   113   void SetBoxView(
const int x0, 
const int x1, 
const int y0, 
const int y1, 
const int z0, 
const int z1 )
   127   void SetSliceView(
const int coronal, 
const int sagittal, 
const int transverse )
   129     m_SliceView[0]=coronal, m_SliceView[1]=sagittal, m_SliceView[2]=transverse;
   136   void SetFlip(
const int flipx, 
const int flipy, 
const int flipz )
   138     m_Flip[0]=flipx, m_Flip[1]=flipy, m_Flip[2]=flipz;
   146   itkSetMacro(Scale, 
double);
   147   itkGetMacro(Scale, 
double);
   159     this->SetNumberOfRequiredInputs(1);
   161     this->SetNumberOfThreads(1);
   171     if (this->IsMaskUsed() && this->m_MaskImage->GetPixel(index)==0)
   174     if ( (m_BoxView[0]>=0 || m_BoxView[1]>=0) && (index[0]<m_BoxView[0] || index[0]>m_BoxView[1]) )
   176     if ( (m_BoxView[2]>=0 || m_BoxView[3]>=0) && (index[1]<m_BoxView[2] || index[1]>m_BoxView[3]) )
   178     if ( (m_BoxView[4]>=0 || m_BoxView[5]>=0) && (index[2]<m_BoxView[4] || index[2]>m_BoxView[5]) )
   181     if ( (m_SliceView[0]>=0 || m_SliceView[1]>=0 || m_SliceView[2]>=0) && index[0]!=m_SliceView[0] && index[1]!=m_SliceView[1] && index[2]!=m_SliceView[2])
   193     PrintVar(
true, os<<indent, m_Scale );
   197     PrintVar(
true, os<<indent, m_ColorScheme);
   198     m_Mesh->Print(std::cout<<
"m_Mesh=");
   203     typename LightObject::Pointer loPtr = Superclass::InternalClone();
   205     typename Self::Pointer rval = 
dynamic_cast<Self *
>(loPtr.GetPointer());
   208       itkExceptionMacro(<< 
"downcast to type " << this->GetNameOfClass()<< 
" failed.");
   210     rval->m_Scale = m_Scale;
   211     rval->m_ColorScheme = m_ColorScheme;
   213     rval->m_BoxView = m_BoxView;
   214     rval->m_SliceView = m_SliceView;
   216     rval->m_Flip = m_Flip;
   225     typename TInputImage::Pointer outputPtr = itkDynamicCastInDebugMode< TInputImage * >( this->GetPrimaryOutput() );
   226     InputImagePointer inputPtr = 
const_cast<InputImageType *
>(this->GetInput());
   228     outputPtr->SetNumberOfComponentsPerPixel(1);
   236   OutputMeshPolyDataPointer m_Mesh = OutputMeshPolyDataType::New();
   240   ColorSchemeType m_ColorScheme=UNKNOWN;
   243   std::vector<int> m_BoxView = std::vector<int>(6,-1);
   246   std::vector<int> m_SliceView = std::vector<int>(3,-1);
   249   std::vector<int> m_Flip = std::vector<int>(3, 0);
   253   void operator=(
const Self&);
 
utl_shared_ptr< MatrixType > MatrixPointer
 
void SetBoxView(const int x0, const int x1, const int y0, const int y1, const int z0, const int z1)
 
InputImageType::Pointer InputImagePointer
 
virtual void GenerateOutputInformation() ITK_OVERRIDE
 
LightObject::Pointer InternalClone() const ITK_OVERRIDE
 
void SetFlip(const int flipx, const int flipy, const int flipz)
 
InputImageType::RegionType InputImageRegionType
 
std::vector< double > STDVectorType
 
MeshFromImageImageFilter()
 
vtkDoubleArray OutputMeshScalarType
 
SmartPointer< const Self > ConstPointer
 
TInputImage InputImageType
 
MaskedImageToImageFilter< TInputImage, TInputImage > Superclass
 
virtual void VerifyInputParameters() const ITK_OVERRIDE
 
InputImageType::PointType InputImagePointType
 
InputImageType::SizeValueType InputImageSizeValueType
 
vtkUnsignedCharArray OutputMeshRGBType
 
utl_shared_ptr< STDVectorType > STDVectorPointer
 
MeshFromImageImageFilter Self
 
Compute mesh from SH coefficients. 
 
utl::NDArray< double, 1 > VectorType
 
void CopyImageInformation(const SmartPointer< ImageWithInfoType > &imageFrom, SmartPointer< ImageType > &imageTo)
 
OutputMeshPolyDataPointer GetOutput()
 
InputImageType::ConstPointer InputImageConstPointer
 
ImageToImageFilter with mask and threaded logger support. 
 
#define PrintVar(cond, os,...)                                                                                                                                                
 
std::vector< int > GetFlip() const 
 
std::vector< int > GetSliceView() const 
 
vtkSmartPointer< OutputMeshPolyDataType > OutputMeshPolyDataPointer
 
virtual void AllocateOutputs() ITK_OVERRIDE
 
InputImageType::PixelType InputImagePixelType
 
void PrintVector(const std::vector< T > &vec, const std::string &str="", const char *separate=" ", std::ostream &os=std::cout, bool showStats=true)
 
void SetSliceView(const int coronal, const int sagittal, const int transverse)
 
utl::NDArray< double, 2 > MatrixType
 
InputImageType::SpacingType InputImageSpacingType
 
virtual bool IsPixelIndexVisible(const InputImageIndexType &index)
 
InputImageType::IndexType InputImageIndexType
 
vtkPoints OutputMeshPointsType
 
TOutputMesh OutputMeshPolyDataType
 
utl_shared_ptr< VectorType > VectorPointer
 
SmartPointer< Self > Pointer
 
void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE
 
std::vector< int > GetBoxView() const 
 
InputImageType::SizeType InputImageSizeType
 
vtkCellArray OutputMeshCellArrayType
 
~MeshFromImageImageFilter()