--- /dev/null
+/*=========================================================================
+ Program: vv http://www.creatis.insa-lyon.fr/rio/vv
+
+ Authors belong to:
+ - University of LYON http://www.universite-lyon.fr/
+ - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
+ - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the copyright notices for more information.
+
+ It is distributed under dual licence
+
+ - BSD See included LICENSE.txt file
+ - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+ ======================================================================-====*/
+
+#ifndef CLITKEXTRACTSLICEFILTER_H
+#define CLITKEXTRACTSLICEFILTER_H
+
+// clitk
+#include "clitkFilterBase.h"
+
+// itk
+#include "itkPasteImageFilter.h"
+
+// itk ENST
+#include "RelativePositionPropImageFilter.h"
+
+namespace clitk {
+
+ //--------------------------------------------------------------------
+ /*
+ Let A be an initial label image.
+ Let B be a label image with an object.
+ Let o be an orientation relatively to the B object (for example RightTo, AntTo, InferiorTo ...)
+
+ This filter removes (=set background) from A all points that are
+ not in the wanted o orientation. It uses downsampled version for
+ faster processing, and (try to) take into account discretization
+ problem. Uses [Bloch 1999].
+ */
+ //--------------------------------------------------------------------
+
+ template <class ImageType>
+ class ITK_EXPORT ExtractSliceFilter:
+ public clitk::FilterBase,
+ public itk::ImageToImageFilter<ImageType,
+ std::vector<typename itk::Image<typename ImageType::PixelType,
+ ImageType::ImageDimension-1>::Pointer> >
+ {
+
+ public:
+ /** Standard class typedefs. */
+ typedef itk::ImageToImageFilter<ImageType, ImageType> Superclass;
+ typedef ExtractSliceFilter Self;
+ typedef itk::SmartPointer<Self> Pointer;
+ typedef itk::SmartPointer<const Self> ConstPointer;
+
+ /** Method for creation through the object factory. */
+ itkNewMacro(Self);
+
+ /** Run-time type information (and related methods). */
+ itkTypeMacro(ExtractSliceFilter, ImageToImageFilter);
+ FILTERBASE_INIT;
+
+ /** Some convenient typedefs. */
+ typedef typename ImageType::ConstPointer ImageConstPointer;
+ typedef typename ImageType::Pointer ImagePointer;
+ typedef typename ImageType::RegionType RegionType;
+ typedef typename ImageType::PixelType PixelType;
+ typedef typename ImageType::SpacingType SpacingType;
+ typedef typename ImageType::SizeType SizeType;
+
+ /** ImageDimension constants */
+ itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
+
+ /** Slice image type **/
+ typedef itk::Image<PixelType, ImageDimension-1> SliceType;
+ typedef typename SliceType::Pointer SliceTypePointer;
+
+ /** Input : initial image and object */
+ void SetInput(const ImageType * image);
+
+ // Options
+ itkGetConstMacro(Direction, int);
+ itkSetMacro(Direction, int);
+
+ protected:
+ ExtractSliceFilter();
+ virtual ~ExtractSliceFilter() {}
+
+ int m_Direction;
+
+ virtual void GenerateOutputInformation();
+ virtual void GenerateInputRequestedRegion();
+ virtual void GenerateData();
+
+ ImagePointer input;
+ ImagePointer object;
+ std::vector<SliceTypePointer> output;
+
+ private:
+ ExtractSliceFilter(const Self&); //purposely not implemented
+ void operator=(const Self&); //purposely not implemented
+
+ }; // end class
+ //--------------------------------------------------------------------
+
+} // end namespace clitk
+//--------------------------------------------------------------------
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#include "clitkExtractSliceFilter.txx"
+#endif
+
+#endif
--- /dev/null
+/*=========================================================================
+ Program: vv http://www.creatis.insa-lyon.fr/rio/vv
+
+ Authors belong to:
+ - University of LYON http://www.universite-lyon.fr/
+ - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
+ - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the copyright notices for more information.
+
+ It is distributed under dual licence
+
+ - BSD See included LICENSE.txt file
+ - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+ ======================================================================-====*/
+
+// clitk
+#include "clitkCommon.h"
+
+
+//--------------------------------------------------------------------
+template <class ImageType>
+clitk::ExtractSliceFilter<ImageType>::
+ExtractSliceFilter():
+ clitk::FilterBase(),
+ itk::ImageToImageFilter<ImageType, ImageType>()
+{
+ this->SetNumberOfRequiredInputs(1);
+ SetDirection(2);
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template <class ImageType>
+void
+clitk::ExtractSliceFilter<ImageType>::
+SetInput(const ImageType * image) {
+ // Process object is not const-correct so the const casting is required.
+ this->SetNthInput(0, const_cast<ImageType *>(image));
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template <class ImageType>
+void
+clitk::ExtractSliceFilter<ImageType>::
+GenerateOutputInformation() {
+ DD("GenerateOutputInformation");
+ ImagePointer input = dynamic_cast<ImageType*>(itk::ProcessObject::GetInput(0));
+ // ImagePointer outputImage = this->GetOutput(0);
+ // outputImage->SetRegions(input->GetLargestPossibleRegion());
+
+ output = this->GetOutput(0);
+
+ // create vector
+ typename SliceType::RegionType SliceRegionType;
+ typename SliceType::SizeType SliceSizeType;
+ typename SliceType::IndexType SliceIndexType;
+ // SliceRegionType region;
+
+ // create region
+ // loop ExtractImageFilter with region updated, push_back
+
+
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template <class ImageType>
+void
+clitk::ExtractSliceFilter<ImageType>::
+GenerateInputRequestedRegion() {
+ DD("GenerateInputRequestedRegion");
+ // Call default
+ itk::ImageToImageFilter<ImageType, ImageType>::GenerateInputRequestedRegion();
+ // Get input pointers and set requested region to common region
+ ImagePointer input = dynamic_cast<ImageType*>(itk::ProcessObject::GetInput(0));
+ input->SetRequestedRegion(input->GetLargestPossibleRegion());
+}
+//--------------------------------------------------------------------
+
+//--------------------------------------------------------------------
+template <class ImageType>
+void
+clitk::ExtractSliceFilter<ImageType>::
+GenerateData() {
+ DD("GenerateData");
+
+ // Get input pointer
+ input = dynamic_cast<ImageType*>(itk::ProcessObject::GetInput(0));
+
+
+
+ //--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ // Final Step -> set output
+ //this->SetNthOutput(0, working_image);
+ return;
+}
+//--------------------------------------------------------------------
+