[Insight-users] PasteImage Filter

Kannan U V kannanuv at cshl.edu
Tue Oct 9 17:59:10 EDT 2012


Hi Brad,
I am using /usr/bin/c++ on a Mac as the compiler.

retina:InsightToolkit-bin kannanuv$ /usr/bin/c++ -v
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.3.0
Thread model: posix

I am using unsigned short 2D image.

I re-build ITK with testing on. I did make; make install.

retina:bin kannanuv$ /Applications/CMake\ 2.8-8.app/Contents/bin/ctest
 -V -R itkImageAlgorithmCopyTest$
UpdateCTestConfiguration  from :/usr/bin/DartConfiguration.tcl
UpdateCTestConfiguration  from :/usr/bin/DartConfiguration.tcl
Test project /usr/bin
Cannot create directory /usr/bin/Testing/Temporary
Cannot create log file: LastTest.log
Constructing a list of tests
Checking test dependency graph...
Checking test dependency graph end
No tests were found!!!

but when I did
retina:InsightToolkit-bin kannanuv$ find ./ -name "itkImageAlgorithmCopyTest*"
.//Modules/Core/Common/test/CMakeFiles/ITKCommon2TestDriver.dir/itkImageAlgorithmCopyTest.cxx.o

Am I doing something wrong with the TEST build?

On Sun, Oct 7, 2012 at 4:15 PM, Bradley Lowekamp <blowekamp at mail.nih.gov> wrote:
> Hello Kannann,
>
> My brief last reply didn't make it to the mailing list, so I'll explain further.
>
> Have you tried enabling the "InPlace" option?
>
> By default the PasteImageFilter ( or most any other filter ) will create a new image for the output. This adds additional overhead to the filter which is what you may be experiencing. Some filters are derived from the InPlaceImageFilter, and have an "InPlace" option. When this option is enabled the input image is reused as the output image, for the paste image filter this will reduce the over head by not having to copy the image.
>
> Recently with ITK 4.1 there has been an optimized ImageAgorithm::Copy method implemented. Under certain conditions the methods will be optimized to a memcpy. On my systems this resulted in over 100X performance in some cases over the ITK iterator methods. It would be good to know if your system is taking advantage of this. What is your compiler and what is the specific image type you are using? There is a test to evaluate this performance if you compile ITK with the test enabled it's called itkImageAlgorithmCopyTest and can be run by  "ctest -V -R itkImageAlgorithmCopyTest$"
>
> Thanks,
> Brad
>
> On Oct 5, 2012, at 6:46 PM, Kannan U V <kannanuv at cshl.edu> wrote:
>
>> Thanks Bill. I built it in Release mode and still it is nearly a 1:2
>> slower performance.
>>
>> For release, I am using the following gcc arguments.
>>
>> CMAKE_CXX_FLAGS_RELEASE -O3 -DNDEBUG
>>
>> Is there any thing else that I can do?
>>
>> On Fri, Oct 5, 2012 at 6:25 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>>> Make sure you build your application in Release mode. If you are building
>>> Debug, ITK can be 10 to 50 times slower.
>>>
>>> On Fri, Oct 5, 2012 at 6:00 PM, Kannan U V <kannanuv at cshl.edu> wrote:
>>>>
>>>> I was missing a update on the pasteFilter. Now that the paste image
>>>> filter works. but the performance is 1:4 times worse than just copying
>>>> pixels from tile to mosaic from the tiles. Is there a way I can
>>>> improve this performance issue?
>>>>
>>>> On Thu, Sep 20, 2012 at 6:08 PM, Kannan U V <kannanuv at cshl.edu> wrote:
>>>>> Hi All,
>>>>> I am trying to use PasteImageFilter on a grid of image tiles. (These
>>>>> are tiles with overlap) I know the position of the tiles and I want to
>>>>> paste them on to the montage. I am using pasteImage filter. When I use
>>>>> the following routine and I get only the last written time in the
>>>>> mosaic image and all other regions are set to zero.
>>>>>
>>>>> Moreover if I don't do a set regions on the mosaicImage I get a write
>>>>> error on image writer. I need help figuring out how it has to be run.
>>>>>
>>>>> for (int iY = 1; iY < 2; iY++) {
>>>>>    for (int iX = 1; iX < 3; iX++) {
>>>>>      cout << "Processing tile : (" << iX << "," << iY << ")" << endl;
>>>>>      CreateConstantImage (tileImage, (iX + iY));
>>>>>      pasteFilter->SetSourceImage(tileImage);
>>>>>      pasteFilter->SetDestinationImage (mosaicImage);
>>>>>
>>>>> pasteFilter->SetSourceRegion(tileImage->GetLargestPossibleRegion());
>>>>>
>>>>>      mosaicIndex1[0] = iX * 812;
>>>>>      mosaicIndex1[1] = iY * 812;
>>>>>      pasteFilter->SetDestinationIndex(mosaicIndex1);
>>>>>
>>>>>      mosaicImage = pasteFilter->GetOutput();
>>>>>      mosaicImage->SetRegions(region);
>>>>>
>>>>>  }
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Thanks,
>>>>> Kannan
>>>>
>>>>
>>>>
>>>> --
>>>> Thanks,
>>>> Kannan
>>>> _____________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Kitware offers ITK Training Courses, for more information visit:
>>>> http://www.kitware.com/products/protraining.php
>>>>
>>>> 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-users
>>>
>>>
>>>
>>>
>>> --
>>> Unpaid intern in BillsBasement at noware dot com
>>>
>>
>>
>>
>> --
>> Thanks,
>> Kannan
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.php
>>
>> 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-users
>



-- 
Thanks,
Kannan


More information about the Insight-users mailing list