[Rtk-users] rtkThreeDCircularProjectionGeometry cannot be cloned

Simon Rit simon.rit at creatis.insa-lyon.fr
Wed Oct 25 12:03:15 EDT 2017


Dear Fredrik,
Thanks for the report. I actually never use this function. I checked and I
have a similar behavior with itk::Image:

#include "itkImage.h"

int main(int argc, char *argv[])
{
  typedef float PixelType;
  const unsigned int Dimension = 3;
  typedef itk::Image< PixelType, Dimension > ImageType;

  ImageType::Pointer img = ImageType::New();
  ImageType::RegionType reg;
  reg.SetSize(0,128);
  reg.SetSize(1,128);
  reg.SetSize(2,128);
  img->SetRegions(reg);
  img->Allocate();
  img->Print(std::cout);
  ImageType::Pointer imgClone = img->Clone();
  imgClone->Print(std::cout);
  return 0;
}

The standard output shows that the two images are of the same type but
don't contain the same members, e.g., not the same region. It seems that
copying an image is done using the Copy function in ImageAlgorithms.
If we want to change the behavior for the geometry object, we need to
re-implement InternalClone()
<https://itk.org/Doxygen/html/classitk_1_1LightObject.html#a2d043fc03a87de736ebdec6214f7e817>.
Are you used to use the Clone function in ITK?
BTW, I wonder why would one want to do a clone of a geometry but we can
probably implement it if it is useful for you.
Best regards,
Simon

On Wed, Oct 25, 2017 at 2:15 PM, Fredrik Hellman <fredrik.hellman at gmail.com>
wrote:

> Hi,
>
> I would like to clone a geometry object, but it does not seem to be
> possible. Is this the expected behaviour or a bug?
>
> The code below prints
>
> 1
> 0
>
> i.e. the two geometry objects (seemingly clones) have different number of
> projections.
>
> Code:
>
> #include <rtkThreeDCircularProjectionGeometry.h>
> #include <iostream>
>
> int main(int argc, char *argv[])
> {
>   rtk::ThreeDCircularProjectionGeometry::Pointer geometry = rtk::
> ThreeDCircularProjectionGeometry::New();
>
>   double sourceToIsocenterDistance = 1;
>   double sourceToDetectorDistance = 1;
>   double gantryAngleInDegrees = 0;
>   geometry->AddProjection(sourceToIsocenterDistance,
>                           sourceToDetectorDistance,
>                           gantryAngleInDegrees);
>
>   rtk::ThreeDCircularProjectionGeometry::Pointer geometryClone =
> geometry->Clone();
>
>   std::cout << geometry->GetGantryAngles().size() << std::endl;
>   std::cout << geometryClone->GetGantryAngles().size() << std::endl;
>
>   return 0;
> }
>
> Best regards,
> Fredrik
>
> _______________________________________________
> Rtk-users mailing list
> Rtk-users at public.kitware.com
> http://public.kitware.com/mailman/listinfo/rtk-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/rtk-users/attachments/20171025/88bad9ea/attachment.html>


More information about the Rtk-users mailing list