[Rtk-users] Linker problem

MORY, CYRIL Cyril.Mory at philips.com
Thu May 30 11:48:33 EDT 2013


Hi,

I've written a small filter deriving from rtk::BackProjectionImageFilter, because I needed to access the protected methods GetProjection() and GetIndexToIndexProjectionMatrix() for a CUDA filter I'm writing.
The filter has only two additional methods, both public, called  PublicGetProjection() and PublicGetIndexToIndexProjectionMatrix(), which call their protected counterparts.
The .h and .txx files are below.

When creating this filter in my CUDA filter, I get an error message from the linker :
../../bin/librtkcuda.a(rtkCudaProjectionStackToFourDImageFilter.cxx.o): In function `rtk::PublicBackProjectionImageFilter<itk::Image<float, 3u>, itk::Image<float, 3u> >::New()':
/home/cyril/sources/rtk/RTK/code/rtkPublicBackProjectionImageFilter.h:57: undefined reference to `rtk::PublicBackProjectionImageFilter<itk::Image<float, 3u>, itk::Image<float, 3u> >::PublicBackProjectionImageFilter()'
collect2: error: ld returned 1 exit status

It's probably a stupid mistake, but I can't find it. Can someone help me ?

rtkPublicBackProjectionImageFilter.h


#ifndef __rtkPublicBackProjectionImageFilter_h
#define __rtkPublicBackProjectionImageFilter_h

#include "rtkBackProjectionImageFilter.h"

namespace rtk
{

/** \class PublicBackProjectionImageFilter
* \brief BackProjectionImageFilter where protected methods are made public
*
* This filter exposes some of the methods that are protected in BackProjectionImageFilter
* Required for CudaProjectionStackToFourDImageFilter
*
* \author Cyril Mory
*
* \ingroup Projector
*/
template <class TInputImage, class TOutputImage>
class ITK_EXPORT PublicBackProjectionImageFilter :
        public rtk::BackProjectionImageFilter<TInputImage,TOutputImage>
{
public:
    /** Standard class typedefs. */
    typedef PublicBackProjectionImageFilter                         Self;
    typedef itk::ImageToImageFilter<TInputImage,TOutputImage> Superclass;
    typedef itk::SmartPointer<Self>                           Pointer;
    typedef itk::SmartPointer<const Self>                     ConstPointer;
    typedef typename TInputImage::PixelType                   InputPixelType;
    typedef typename TOutputImage::RegionType                 OutputImageRegionType;

    typedef rtk::ProjectionGeometry<TOutputImage::ImageDimension>     GeometryType;
    typedef typename GeometryType::Pointer                            GeometryPointer;
    typedef typename GeometryType::MatrixType                         ProjectionMatrixType;
    typedef itk::Image<InputPixelType, TInputImage::ImageDimension-1> ProjectionImageType;
    typedef typename ProjectionImageType::Pointer                     ProjectionImagePointer;

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

    /** Run-time type information (and related methods). */
    itkTypeMacro(PublicBackProjectionImageFilter, BackProjectionImageFilter)

    /** The input is a stack of projections, we need to interpolate in one projection
      for efficiency during interpolation. Use of itk::ExtractImageFilter is
      not threadsafe in ThreadedGenerateData, this one is. The output can be multiplied by a constant. */
    ProjectionImagePointer PublicGetProjection(const unsigned int iProj);

    /** Creates iProj index to index projection matrices with current inputs
      instead of the physical point to physical point projection matrix provided by Geometry */
    ProjectionMatrixType PublicGetIndexToIndexProjectionMatrix(const unsigned int iProj);
protected:
    PublicBackProjectionImageFilter();
    virtual ~PublicBackProjectionImageFilter() {}

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

};

} // end namespace rtk

#ifndef ITK_MANUAL_INSTANTIATION
#include "rtkPublicBackProjectionImageFilter.txx"
#endif

#endif



rtkPublicBackProjectionImageFilter.txx

/*=========================================================================
*
*  Copyright RTK Consortium
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*         http://www.apache.org/licenses/LICENSE-2.0.txt
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*
*=========================================================================*/

#ifndef __rtkPublicBackProjectionImageFilter_txx
#define __rtkPublicBackProjectionImageFilter_txx

#include "rtkPublicBackProjectionImageFilter.h"

namespace rtk
{

//template <class TInputImage, class TOutputImage>
//PublicBackProjectionImageFilter<TInputImage,TOutputImage>
//::PublicBackProjectionImageFilter()
//{
//}

template <class TInputImage, class TOutputImage>
typename PublicBackProjectionImageFilter<TInputImage,TOutputImage>::ProjectionImagePointer
PublicBackProjectionImageFilter<TInputImage,TOutputImage>
::PublicGetProjection(const unsigned int iProj)
{
    return this->GetProjection(iProj);
}

template <class TInputImage, class TOutputImage>
typename PublicBackProjectionImageFilter<TInputImage,TOutputImage>::ProjectionMatrixType
PublicBackProjectionImageFilter<TInputImage,TOutputImage>
::PublicGetIndexToIndexProjectionMatrix(const unsigned int iProj)
{
    return this->GetIndexToIndexProjectionMatrix(iProj);
}

} // end namespace rtk

#endif

________________________________
The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/rtk-users/attachments/20130530/50f3528b/attachment-0008.html>


More information about the Rtk-users mailing list