[Rtk-users] error in ThreeDCircularProjectionGeometry GeometryType

Howard lomahu at gmail.com
Tue Jun 25 09:03:05 EDT 2019


I felt it might be useful to show the cxx code as well including the
header files.

=========================================

#include "rtkGgoFunctions.h"

#include <itkAddImageFilter.h>
#include <itkImageFileReader.h>
#include <itkImageFileWriter.h>
#include <rtkFDKBackProjectionImageFilter.h>
#include <rtkFDKConeBeamReconstructionFilter.h>
#include <rtkThreeDCircularProjectionGeometry.h>


int main(int argc, char * argv[])
{

  typedef float OutputPixelType;
  const unsigned int Dimension = 3;

  typedef itk::Image< OutputPixelType, Dimension > OutputImageType;

  // Defines the RTK geometry object.....We will have to revisit this geometry
  typedef rtk::ThreeDCircularProjectionGeometry GeometryType;
  GeometryType::Pointer geometry = GeometryType::New();

  // Projection matrices
  unsigned int numberOfProjections = 360;
  unsigned int firstAngle = 0;
  unsigned int angularArc = 360;
  unsigned int sid =  80; // source to isocenter distance in mm
  unsigned int sdd = 160; // source to detector distance in mm
  int isox = 0; // X coordinate on the projection image of isocenter
  int isoy = 0; // Y coordinate on the projection image of isocenter


  for(unsigned int noProj=0; noProj<numberOfProjections; noProj++) {
      double angle = (float)firstAngle + (float)noProj * angularArc /
(float)numberOfProjections;
      geometry->AddProjection(sid, sdd, angle, isox, isoy);
  }


   // Define and allocate the FDK Back Projection Filter
   typedef rtk::FDKBackProjectionImageFilter<OutputImageType,
OutputImageType> BPType;
   BPType::Pointer p = BPType::New();

   std::cout << "RTK Hello World!" << std::endl;

  // Write
  //typedef itk::ImageFileWriter< OutputImageType > WriterType;
  //WriterType::Pointer writer = WriterType::New();
  //writer->SetFileName( args_info.output_arg );
  //writer->SetInput( add->GetOutput() );
  //TRY_AND_EXIT_ON_ITK_EXCEPTION( writer->Update() );

  return 0;
}


On 6/25/19, Howard <lomahu at gmail.com> wrote:
> Hi Simon,
>
> Here is the CMakeLists.txt I used for compiling and linking. Thanks
> for looking into the issue.
>
> Howard
>
> ===============================================
>
> cmake_minimum_required(VERSION 3.12)
>
> PROJECT(Test1)
>
> # Find the RTK libraries and includes
> FIND_PACKAGE(RTK REQUIRED)
> INCLUDE(${RTK_USE_FILE})
>
> # Find ITK with RTK
> find_package(ITK REQUIRED)
> include(${ITK_USE_FILE})
>
> # Executable
> ADD_EXECUTABLE(Test1 Test1.cxx )
> TARGET_LINK_LIBRARIES(Test1 ${RTK_LIBRARIES})
> TARGET_LINK_LIBRARIES(Test1 ${ITK_LIBRARIES})
>
>
> On 6/25/19, Simon Rit <simon.rit at creatis.insa-lyon.fr> wrote:
>> Hi Howard,
>> Since it's a linking problem, maybe you should check that you have linked
>> the RTK_libraries, see e.g.,
>> https://github.com/SimonRit/RTK/blob/master/examples/FirstReconstruction/CMakeLists.txt#L12
>> I can try to fix the problem if you provide a full example.
>> Simon
>>
>> On Mon, Jun 24, 2019 at 9:45 PM Howard <lomahu at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I was trying to play with the simple example to reconstruct a sphere
>>> from the RTK wiki page. The sample code:
>>>
>>>  // Projection matrices
>>>   unsigned int numberOfProjections = 360;
>>>   unsigned int firstAngle = 0;
>>>   unsigned int angularArc = 360;
>>>   unsigned int sid =  80; // source to isocenter distance in mm
>>>   unsigned int sdd = 160; // source to detector distance in mm
>>>   int isox = 0; // X coordinate on the projection image of isocenter
>>>   int isoy = 0; // Y coordinate on the projection image of isocenter
>>>
>>>
>>>   for(unsigned int noProj=0; noProj<numberOfProjections; noProj++) {
>>>       double angle = (float)firstAngle + (float)noProj * angularArc /
>>> (float)numberOfProjections;
>>>       geometry->AddProjection(sid, sdd, angle, isox, isoy);
>>>   }
>>>
>>>
>>> When I compiled the code, I got an error from the line in the projection
>>> loop:
>>>
>>> geometry->AddProjection(sid, sdd, angle, isox, isoy);
>>>
>>> I am using an old version of RTK 1.1 but it should not matter. Can
>>> anyone help me out? Thanks!
>>>
>>> [chaom02 at minerva2 recon]$ make
>>> Scanning dependencies of target Test1
>>> [ 50%] Building CXX object CMakeFiles/Test1.dir/Test1.cxx.o
>>> [100%] Linking CXX executable Test1
>>>
>>> /sc/orga/work/chaom02/usr/local/RTK/RTK-bin/bin/libRTK.a(rtkThreeDCircularProjectionGeometry.cxx.o):
>>> In function `itk::MatrixOffsetTransformBase<double, 3u,
>>> 3u>::GetFixedParameters() const':
>>>
>>> rtkThreeDCircularProjectionGeometry.cxx:(.text._ZNK3itk25MatrixOffsetTransformBaseIdLj3ELj3EE18GetFixedParametersEv[_ZNK3itk25MatrixOffsetTransformBaseIdLj3ELj3EE18GetFixedParametersEv]+0x23):
>>> undefined reference to `vnl_vector<double>::set_size(unsigned int)'
>>>
>>> /sc/orga/work/chaom02/usr/local/RTK/RTK-bin/bin/libRTK.a(rtkThreeDCircularProjectionGeometry.cxx.o):
>>> In function `itk::MatrixOffsetTransformBase<double, 3u,
>>> 3u>::SetFixedParameters(itk::OptimizerParameters<double> const&)':
>>>
>>> rtkThreeDCircularProjectionGeometry.cxx:(.text._ZN3itk25MatrixOffsetTransformBaseIdLj3ELj3EE18SetFixedParametersERKNS_19OptimizerParametersIdEE[_ZN3itk25MatrixOffsetTransformBaseIdLj3ELj3EE18SetFixedParametersERKNS_19OptimizerParametersIdEE]+0x4f):
>>> undefined reference to `vnl_vector<double>::set_size(unsigned int)'
>>>
>>> /sc/orga/work/chaom02/usr/local/RTK/RTK-bin/bin/libRTK.a(rtkThreeDCircularProjectionGeometry.cxx.o):
>>> In function
>>> `itk::CenteredEuler3DTransform<double>::SetParameters(itk::OptimizerParameters<double>
>>> const&)':
>>>
>>> rtkThreeDCircularProjectionGeometry.cxx:(.text._ZN3itk24CenteredEuler3DTransformIdE13SetParametersERKNS_19OptimizerParametersIdEE[_ZN3itk24CenteredEuler3DTransformIdE13SetParametersERKNS_19OptimizerParametersIdEE]+0x31):
>>> undefined reference to `vnl_vector<double>::set_size(unsigned int)'
>>>
>>> /sc/orga/work/chaom02/usr/local/RTK/RTK-bin/bin/libRTK.a(rtkThreeDCircularProjectionGeometry.cxx.o):
>>> In function
>>> `itk::Euler3DTransform<double>::SetParameters(itk::OptimizerParameters<double>
>>> const&)':
>>>
>>> rtkThreeDCircularProjectionGeometry.cxx:(.text._ZN3itk16Euler3DTransformIdE13SetParametersERKNS_19OptimizerParametersIdEE[_ZN3itk16Euler3DTransformIdE13SetParametersERKNS_19OptimizerParametersIdEE]+0x40):
>>> undefined reference to `vnl_vector<double>::set_size(unsigned int)'
>>>
>>> /sc/orga/work/chaom02/usr/local/RTK/RTK-bin/bin/libRTK.a(rtkThreeDCircularProjectionGeometry.cxx.o):
>>> In function `itk::Transform<double, 3u, 3u>::Transform(unsigned
>>> long)':
>>>
>>> rtkThreeDCircularProjectionGeometry.cxx:(.text._ZN3itk9TransformIdLj3ELj3EEC2Em[_ZN3itk9TransformIdLj3ELj3EEC5Em]+0x49):
>>> undefined reference to `vnl_vector<double>::vnl_vector(unsigned int)'
>>>
>>> rtkThreeDCircularProjectionGeometry.cxx:(.text._ZN3itk9TransformIdLj3ELj3EEC2Em[_ZN3itk9TransformIdLj3ELj3EEC5Em]+0xa3):
>>> undefined reference to `vnl_vector<double>::vnl_vector(unsigned int)'
>>>
>>> /sc/orga/work/chaom02/usr/local/RTK/RTK-bin/bin/libRTK.a(rtkThreeDCircularProjectionGeometry.cxx.o):
>>> In function `itk::MatrixOffsetTransformBase<double, 3u,
>>> 3u>::MatrixOffsetTransformBase()':
>>>
>>> rtkThreeDCircularProjectionGeometry.cxx:(.text._ZN3itk25MatrixOffsetTransformBaseIdLj3ELj3EEC2Ev[_ZN3itk25MatrixOffsetTransformBaseIdLj3ELj3EEC5Ev]+0x21b):
>>> undefined reference to `vnl_vector<double>::set_size(unsigned int)'
>>>
>>> /sc/orga/work/chaom02/usr/local/RTK/RTK-bin/bin/libRTK.a(rtkThreeDCircularProjectionGeometry.cxx.o):
>>> In function
>>> `itk::Rigid3DTransform<double>::SetParameters(itk::OptimizerParameters<double>
>>> const&)':
>>>
>>> rtkThreeDCircularProjectionGeometry.cxx:(.text._ZN3itk16Rigid3DTransformIdE13SetParametersERKNS_19OptimizerParametersIdEE[_ZN3itk16Rigid3DTransformIdE13SetParametersERKNS_19OptimizerParametersIdEE]+0x3e):
>>> undefined reference to `vnl_vector<double>::set_size(unsigned int)'
>>>
>>> /sc/orga/work/chaom02/usr/local/RTK/RTK-bin/bin/libRTK.a(rtkThreeDCircularProjectionGeometry.cxx.o):
>>> In function `itk::MatrixOffsetTransformBase<double, 3u,
>>> 3u>::SetParameters(itk::OptimizerParameters<double> const&)':
>>>
>>> rtkThreeDCircularProjectionGeometry.cxx:(.text._ZN3itk25MatrixOffsetTransformBaseIdLj3ELj3EE13SetParametersERKNS_19OptimizerParametersIdEE[_ZN3itk25MatrixOffsetTransformBaseIdLj3ELj3EE13SetParametersERKNS_19OptimizerParametersIdEE]+0x43):
>>> undefined reference to `vnl_vector<double>::set_size(unsigned int)'
>>>
>>> /sc/orga/work/chaom02/usr/local/RTK/RTK-bin/bin/libRTK.a(rtkThreeDCircularProjectionGeometry.cxx.o):
>>> In function `itk::MatrixOffsetTransformBase<double, 3u,
>>> 3u>::TransformVector(itk::VariableLengthVector<double> const&) const':
>>>
>>> rtkThreeDCircularProjectionGeometry.cxx:(.text._ZNK3itk25MatrixOffsetTransformBaseIdLj3ELj3EE15TransformVectorERKNS_20VariableLengthVectorIdEE[_ZNK3itk25MatrixOffsetTransformBaseIdLj3ELj3EE15TransformVectorERKNS_20VariableLengthVectorIdEE]+0x2f):
>>> undefined reference to `vnl_vector<double>::vnl_vector(unsigned int)'
>>>
>>> /sc/orga/work/chaom02/usr/local/RTK/RTK-bin/bin/libRTK.a(rtkThreeDCircularProjectionGeometry.cxx.o):
>>> In function `itk::MatrixOffsetTransformBase<double, 3u,
>>> 3u>::TransformCovariantVector(itk::VariableLengthVector<double>
>>> const&) const':
>>>
>>> rtkThreeDCircularProjectionGeometry.cxx:(.text._ZNK3itk25MatrixOffsetTransformBaseIdLj3ELj3EE24TransformCovariantVectorERKNS_20VariableLengthVectorIdEE[_ZNK3itk25MatrixOffsetTransformBaseIdLj3ELj3EE24TransformCovariantVectorERKNS_20VariableLengthVectorIdEE]+0x3a):
>>> undefined reference to `vnl_vector<double>::vnl_vector(unsigned int)'
>>> collect2: error: ld returned 1 exit status
>>> make[2]: *** [Test1] Error 1
>>> make[1]: *** [CMakeFiles/Test1.dir/all] Error 2
>>> make: *** [all] Error 2
>>> _______________________________________________
>>> Rtk-users mailing list
>>> Rtk-users at public.kitware.com
>>> https://public.kitware.com/mailman/listinfo/rtk-users
>>>
>>
>


More information about the Rtk-users mailing list