Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addressing warnings #4

Merged
merged 1 commit into from
Jul 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|isl|json)/)'
Expand Down
6 changes: 4 additions & 2 deletions include/itkRLEImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class RLEImage :
* or other operations. */
typedef TPixel PixelType;

typedef CounterType RLCounterType;

/** Typedef alias for PixelType */
typedef TPixel ValueType;

Expand Down Expand Up @@ -180,7 +182,7 @@ class RLEImage :
* Returns difference in line length which happens due to merging or splitting segments.
* This method is used by iterators directly. */
int
SetPixel( RLLine& line, IndexValueType& segmentRemainder, IndexValueType& m_RealIndex, const TPixel& value );
SetPixel( RLLine& line, IndexValueType& segmentRemainder, SizeValueType& m_RealIndex, const TPixel& value );

/** \brief Get a pixel. SLOW! Better use iterators for pixel access. */
const TPixel&
Expand Down Expand Up @@ -312,4 +314,4 @@ class RLEImage :
#include "itkRLEImage.hxx"
#endif

#endif // itkRLEImage_h
#endif // itkRLEImage_h
8 changes: 4 additions & 4 deletions include/itkRLEImage.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ RLEImage< TPixel, VImageDimension, CounterType >
template < typename TPixel, unsigned int VImageDimension, typename CounterType >
int
RLEImage< TPixel, VImageDimension, CounterType >
::SetPixel( RLLine& line, IndexValueType& segmentRemainder, IndexValueType& m_RealIndex, const TPixel& value )
::SetPixel( RLLine& line, IndexValueType& segmentRemainder, SizeValueType& m_RealIndex, const TPixel& value )
{
// complete Run-Length Lines have to be buffered
itkAssertOrThrowMacro( this->GetBufferedRegion().GetSize( 0 ) == this->GetLargestPossibleRegion().GetSize( 0 ), "BufferedRegion must contain complete run-length lines!" );
Expand Down Expand Up @@ -237,7 +237,7 @@ RLEImage< TPixel, VImageDimension, CounterType >
typename BufferType::IndexType bi = truncateIndex( index );
RLLine& line = m_Buffer->GetPixel( bi );
IndexValueType t = 0;
for ( IndexValueType x = 0; x < line.size(); x++ )
for ( SizeValueType x = 0; x < line.size(); x++ )
{
t += line[x].first;
if ( t > index[0] - bri0 )
Expand All @@ -261,7 +261,7 @@ RLEImage< TPixel, VImageDimension, CounterType >
typename BufferType::IndexType bi = truncateIndex( index );
RLLine& line = m_Buffer->GetPixel( bi );
IndexValueType t = 0;
for ( IndexValueType x = 0; x < line.size(); x++ )
for ( SizeValueType x = 0; x < line.size(); x++ )
{
t += line[x].first;
if ( t > index[0] - bri0 )
Expand Down Expand Up @@ -299,4 +299,4 @@ RLEImage< TPixel, VImageDimension, CounterType >
os.precision( prec );
} // >::PrintSelf
} // end namespace itk
#endif // itkRLEImage_hxx
#endif // itkRLEImage_hxx
4 changes: 2 additions & 2 deletions include/itkRLEImageConstIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ friend class ::MultiLabelMeshPipeline;

const RLLine* m_RunLengthLine;

mutable IndexValueType m_RealIndex; // index into line's segment
mutable SizeValueType m_RealIndex; // index into line's segment
mutable IndexValueType m_SegmentRemainder; // how many pixels remain in current segment

IndexValueType m_BeginIndex0; // index to first pixel in region in relation to buffer start
Expand Down Expand Up @@ -474,4 +474,4 @@ class ImageConstIteratorWithOnlyIndex< RLEImage< TPixel, VImageDimension, Counte
}; // no additional implementation required
} // end namespace itk

#endif // itkRLEImageConstIterator_h
#endif // itkRLEImageConstIterator_h
2 changes: 1 addition & 1 deletion include/itkRLEImageIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,4 @@ class ImageIteratorWithIndex< RLEImage< TPixel, VImageDimension, CounterType > >
}; // no additional implementation required
} // end namespace itk

#endif // itkRLEImageIterator_h
#endif // itkRLEImageIterator_h
2 changes: 1 addition & 1 deletion include/itkRLEImageRegionConstIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,4 +251,4 @@ class ImageRegionConstIteratorWithOnlyIndex< RLEImage< TPixel, VImageDimension,
}; // no additional implementation required
} // end namespace itk

#endif // itkRLEImageRegionConstIterator_h
#endif // itkRLEImageRegionConstIterator_h
2 changes: 1 addition & 1 deletion include/itkRLEImageRegionIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,4 @@ class ImageRegionIteratorWithIndex< RLEImage< TPixel, VImageDimension, CounterTy
}; // no additional implementation required
} // end namespace itk

#endif // itkRLEImageRegionIterator_h
#endif // itkRLEImageRegionIterator_h
2 changes: 1 addition & 1 deletion include/itkRLEImageScanlineConstIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,4 @@ class ImageScanlineConstIterator< RLEImage< TPixel, VImageDimension, CounterType
};
} // end namespace itk

#endif // itkRLEImageScanlineConstIterator_h
#endif // itkRLEImageScanlineConstIterator_h
2 changes: 1 addition & 1 deletion include/itkRLEImageScanlineIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ class ImageScanlineIterator< RLEImage< TPixel, VImageDimension, CounterType > >
};
} // end namespace itk

#endif // itkRLEImageScanlineIterator_h
#endif // itkRLEImageScanlineIterator_h
101 changes: 100 additions & 1 deletion include/itkRLERegionOfInterestImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,105 @@ class RegionOfInterestImageFilter< RLEImage< TPixel, VImageDimension, CounterTyp
RegionType m_RegionOfInterest;
};

template < typename TPixelIn, typename TPixelOut, unsigned int VImageDimension, typename CounterTypeIn, typename CounterTypeOut >
class RegionOfInterestImageFilter< RLEImage< TPixelIn, VImageDimension, CounterTypeIn >, RLEImage< TPixelOut, VImageDimension, CounterTypeOut > >
: public ImageToImageFilter< RLEImage< TPixelIn, VImageDimension, CounterTypeIn >, RLEImage< TPixelOut, VImageDimension, CounterTypeOut > >
{
public:
/** Standard class typedefs. */
typedef RegionOfInterestImageFilter Self;
typedef RLEImage< TPixelIn, VImageDimension, CounterTypeIn > RLEImageTypeIn;
typedef RLEImage< TPixelOut, VImageDimension, CounterTypeOut > RLEImageTypeOut;
typedef RLEImageTypeOut ImageType;
typedef ImageToImageFilter< RLEImageTypeIn, RLEImageTypeOut > Superclass;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
typedef typename Superclass::InputImageRegionType InputImageRegionType;

/** Method for creation through the object factory. */
itkNewMacro( Self );

/** Run-time type information (and related methods). */
itkTypeMacro( RegionOfInterestImageFilter, ImageToImageFilter );

/** Typedef to describe the input image region types. */
typedef typename RLEImageTypeIn::RegionType RegionType;
typedef typename RLEImageTypeIn::IndexType IndexType;
typedef typename RLEImageTypeIn::SizeType SizeType;

/** Typedef to describe the type of pixel. */
typedef typename RLEImageTypeOut::PixelType OutputImagePixelType;
typedef typename RLEImageTypeIn::PixelType InputImagePixelType;

/** Set/Get the output image region. */
itkSetMacro( RegionOfInterest, RegionType );
itkGetConstMacro( RegionOfInterest, RegionType );

/** ImageDimension enumeration */
itkStaticConstMacro( ImageDimension, unsigned int, VImageDimension );
itkStaticConstMacro( OutputImageDimension, unsigned int, VImageDimension );

#ifdef ITK_USE_CONCEPT_CHECKING
// Begin concept checking
itkConceptMacro( SameDimensionCheck, (Concept::SameDimension< ImageDimension, OutputImageDimension >));
itkConceptMacro( InputConvertibleToOutputCheck, (Concept::Convertible< InputImagePixelType, OutputImagePixelType >));
// End concept checking
#endif

protected:
RegionOfInterestImageFilter() {}
~RegionOfInterestImageFilter() {}
void
PrintSelf( std::ostream& os, Indent indent ) const;

virtual void
GenerateInputRequestedRegion();

virtual void
EnlargeOutputRequestedRegion( DataObject* output );

/** RegionOfInterestImageFilter can produce an image which is a different
* size than its input image. As such, RegionOfInterestImageFilter
* needs to provide an implementation for
* GenerateOutputInformation() in order to inform the pipeline
* execution model. The original documentation of this method is
* below.
*
* \sa ProcessObject::GenerateOutputInformaton() */
virtual void
GenerateOutputInformation();

/** RegionOfInterestImageFilter can be implemented as a multithreaded filter.
* Therefore, this implementation provides a ThreadedGenerateData()
* routine which is called for each processing thread. The output
* image data is allocated automatically by the superclass prior to
* calling ThreadedGenerateData(). ThreadedGenerateData can only
* write to the portion of the output image specified by the
* parameter "outputRegionForThread"
* \sa ImageToImageFilter::ThreadedGenerateData(),
* ImageToImageFilter::GenerateData() */
void
ThreadedGenerateData( const RegionType& outputRegionForThread, ThreadIdType threadId );

private:
RegionOfInterestImageFilter( const Self& ); // purposely not implemented
void
operator=( const Self& ); // purposely not implemented

RegionType m_RegionOfInterest;
};

//not implemented on purpose, so it will produce a meaningful error message
template < unsigned int VImageDimensionIn, unsigned int VImageDimensionOut >
class InputAndOutputImagesMustHaveSameDimension;

//input and output images must have the same dimension (e.g. both 2D or both 3D)
//so disallow this by inheriting from unimplemented base class
template < typename TPixelIn, typename TPixelOut, unsigned int VImageDimensionIn, unsigned int VImageDimensionOut, typename CounterTypeIn, typename CounterTypeOut >
class RegionOfInterestImageFilter< RLEImage< TPixelIn, VImageDimensionIn, CounterTypeIn >, RLEImage< TPixelOut, VImageDimensionOut, CounterTypeOut > >
: InputAndOutputImagesMustHaveSameDimension< VImageDimensionIn, VImageDimensionOut >
{};

template < typename TPixel, unsigned int VImageDimension, typename CounterType >
class RegionOfInterestImageFilter< Image< TPixel, VImageDimension >, RLEImage< TPixel, VImageDimension, CounterType > >
: public ImageToImageFilter< Image< TPixel, VImageDimension >, RLEImage< TPixel, VImageDimension, CounterType > >
Expand Down Expand Up @@ -312,4 +411,4 @@ class RegionOfInterestImageFilter< RLEImage< TPixel, VImageDimension, CounterTyp
#include "itkRLERegionOfInterestImageFilter.hxx"
#endif

#endif // itkRLERegionOfInterestImageFilter_h
#endif // itkRLERegionOfInterestImageFilter_h
Loading