[Insight-developers] Small modification to ImportImageContainer

Bill Lorensen bill.lorensen at gmail.com
Thu Mar 19 11:51:03 EDT 2009


Tom,

Another possibility is to use the object factory mechanism to provide
an override to ImportImageContainer. The test
Testing/Code.Common/itkObjectFactoryTest2.cxx shows how
ImportImageContainer can be overriden.

Bill


On Thu, Mar 19, 2009 at 7:51 AM, Tom Vercauteren
<tom.vercauteren at m4x.org> wrote:
> Hi,
>
> At my company, we needed to have ITK images for which buffers are
> ensured to be aligned (say on 8 bits). This can be done by overloading
> itk::Image and itk::ImportImageContainer.
>
> However, it also requires a patch to ImportImageContainer for it to be
> "overloadable". Basically, the attached patch only amounts to:
> 1) Putting all the memory deallocation in a single virtual function
> 2) Moving some member variables from private to protected
>
> There should be no backward compatibility issue with this. All unit
> tests are still green on my computer.
>
>
> By looking into ImportImageContainer, I also realized that Reserve is
> wrong in the sense that it has a Resize semantics. This is similar to
> the following VectorContainer and the MapContainer bug:
> http://www.itk.org/Bug/view.php?id=2893
>
> Since it was decided not to fix bug 2893, I haven't fixed
> ImportImageContainer::Reserve either but simply added some comments to
> the file.
>
> Let me know if you see any potential problem with this patch.
>
> Thanks,
> Tom
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
>
>


More information about the Insight-developers mailing list