<div dir="ltr">Dear Simon,<div><br></div><div>No, I can't say I have used the Clone function before. I am writing a geometry converter class that takes ThreeDCircularProjectionGeometry through a setter-function. The converter is supposed to give detector positions etc. on demand in a different coordinate system.</div><div><br></div><div>I need to determine what behavior I want of this converter:<br></div><div><br></div><div>1. Either the converter tracks the ThreeDCircularProjectionGeometry object with a smart pointer. All changes in the geometry by the caller so the setter is reflected in the converter.</div><div>2. Or the object is cloned and the converter will reflect the object as it was when it was set, regardless of any changes done to it by the caller.</div><div><br></div><div>Actually, I think I can do with behavior 1. However, as it is now, I don't think I have possibility to implement behavior 2 at all.</div><div><br></div><div>Best regards,</div><div>Fredrik</div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-10-25 18:03 GMT+02:00 Simon Rit <span dir="ltr"><<a href="mailto:simon.rit@creatis.insa-lyon.fr" target="_blank">simon.rit@creatis.insa-lyon.fr</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Dear Fredrik,<br></div>Thanks for the report. I actually never use this function. I checked and I have a similar behavior with itk::Image:<br><br>#include "itkImage.h"<span class=""><br><br>int main(int argc, char *argv[])<br>{<br></span> typedef float PixelType;<br> const unsigned int Dimension = 3;<br> typedef itk::Image< PixelType, Dimension > ImageType;<br><br> ImageType::Pointer img = ImageType::New();<br> ImageType::RegionType reg;<br> reg.SetSize(0,128);<br> reg.SetSize(1,128);<br> reg.SetSize(2,128);<br> img->SetRegions(reg);<br> img->Allocate();<br> img->Print(std::cout);<br> ImageType::Pointer imgClone = img->Clone();<br> imgClone->Print(std::cout);<br> return 0;<br>}<br><br></div>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.</div><div>If we want to change the behavior for the geometry object, we need to re-implement <a href="https://itk.org/Doxygen/html/classitk_1_1LightObject.html#a2d043fc03a87de736ebdec6214f7e817" target="_blank">InternalClone()</a>. Are you used to use the Clone function in ITK?</div><div>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.<br></div>Best regards,<br></div>Simon<br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Wed, Oct 25, 2017 at 2:15 PM, Fredrik Hellman <span dir="ltr"><<a href="mailto:fredrik.hellman@gmail.com" target="_blank">fredrik.hellman@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div>Hi,</div><div><br></div><div>I would like to clone a geometry object, but it does not seem to be possible. Is this the expected behaviour or a bug?</div><div><br></div><div>The code below prints</div><div><br></div><div>1</div><div>0</div><div><br></div><div>i.e. the two geometry objects (seemingly clones) have different number of projections.</div><div><br></div><div>Code:</div><div><br></div><div>#include <rtkThreeDCircularProjectionGe<wbr>ometry.h></div><div>#include <iostream><br></div><div><br></div><div>int main(int argc, char *argv[])</div><div>{</div><div> rtk::ThreeDCircularProjectionG<wbr>eometry::Pointer geometry = rtk::ThreeDCircularProjectionG<wbr>eometry::New();</div><div><br></div><div> double sourceToIsocenterDistance = 1;</div><div> double sourceToDetectorDistance = 1;</div><div> double gantryAngleInDegrees = 0;</div><div> geometry->AddProjection(source<wbr>ToIsocenterDistance,</div><div> sourceToDetectorDistance,</div><div> gantryAngleInDegrees);</div><div> </div><div> rtk::ThreeDCircularProjectionG<wbr>eometry::Pointer geometryClone = geometry->Clone();</div><div><br></div><div> std::cout << geometry->GetGantryAngles().si<wbr>ze() << std::endl;</div><div> std::cout << geometryClone->GetGantryAngles<wbr>().size() << std::endl;</div><div><br></div><div> return 0;</div><div>}</div><div><br></div><div>Best regards,</div><div>Fredrik</div></div>
<br></div></div>______________________________<wbr>_________________<br>
Rtk-users mailing list<br>
<a href="mailto:Rtk-users@public.kitware.com" target="_blank">Rtk-users@public.kitware.com</a><br>
<a href="http://public.kitware.com/mailman/listinfo/rtk-users" rel="noreferrer" target="_blank">http://public.kitware.com/mail<wbr>man/listinfo/rtk-users</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>