[ITK] [ITK-users] TileImageFilter SideBySide

Jim Miller millerjv at gmail.com
Wed Aug 20 07:16:59 EDT 2014


Once DisconnectPipeline is called the Image object is completely disassociated with the source filter (in this case a reader). The source filter then constructs a new a Image object to serve as its output. For instance, if you call GetOutput() after calling DisconnectPipeline, you will get a different Image object than one retrieved before DisconnectPipeline is called. 

The pixel buffer is managed by the Image object, not the source/filter/reader. So after a call to DisconnectPipeline(), the reader has a new Image object as it its output and that new Image object has a distinct pixel buffer. Initially this pixel buffer is not even allocated. The act of reading the next image causes the reader to request the Image object to allocate the pixel buffer to an appropriate size. 

If DisconnectPipeline() was not called and the reader was asked to read another image of the same size or smaller, its output Image object would already have an allocated pixel buffer. The reader would still ask the Image object to allocate a pixel buffer of the appropriate size. But in this case, the Image object would recognize that it already has a block of memory of sufficient size and not do another allocation. 

Jim

> On Aug 20, 2014, at 3:37 AM, "Dr. Roman Grothausmann" <grothausmann.roman at mh-hannover.de> wrote:
> 
> Hi
> 
> 
> As this is a nice case of a question I have always had: In the case of the c++ example (http://www.itk.org/Wiki/ITK/Examples/ImageProcessing/TileImageFilter_CreateVolume)
> 
> InputImageType::Pointer inputImageTile;
> 
>  for (int i = 1; i < argc - 1; i++)
>    {
>    reader->SetFileName( argv[i] );
>    reader->UpdateLargestPossibleRegion();
>    inputImageTile = reader->GetOutput();
>    inputImageTile->DisconnectPipeline();
>    tiler->SetInput( inputImageNumber++, inputImageTile );
>    }
> 
> When the reader output is assigned to inputImageTile, I thought this is only a pointer assignment and not a full copy of the image. However, I wonder, what makes sure the address space in the memory is not used (partially) again for the next image read? Is there a full copy created "behind the scene" at any point in the code? Or does the reader remember the address space of former images read even though DisconnectPipeline was called?
> 
> Thanks for any explanations
> Roman
> 
>> On 18/08/14 17:01, Michka Popoff wrote:
>> Hi
>> 
>> Going the way described in the CreateVolume example is the way to go.
>> 
>> Why did you uncomment the DisconnectPipeline() call and Update() call in the for
>> loop ? They need to stay there, else you will always use the last image.
>> That’s why you see the same image, the single update call will be triggered at
>> the end of the script and read only one image.
>> 
>> You don’t need to call tileFilter->Update(), you can remove this line. The
>> writer->Update() will take care of the pipeline update.
>> As a bonus, you may wrap your writer->Update() call, to fetch errors at the end
>> of the pipeline:
>> 
>>   try
>>     {
>>     writer->Update();
>>     }
>>   catch( itk::ExceptionObject & error )
>>     {
>>     std::cerr << "Error: " << error << std::endl;
>>     return EXIT_FAILURE;
>>     }
>> 
>> I made a little Python prototype, the syntax is a little bit different than in
>> C++ but it gives you the main idea.
>> 
>> Michka
>> 
>> 
>> 
>> 
>> On 18 août 2014, at 16:05, Dan Mercik <mercikd at thomas.edu
>> <mailto:mercikd at thomas.edu>> wrote:
>> 
>>> Good Morning,
>>> 
>>> 
>>> 
>>>                       The demonstration you showed me works great, however if
>>> I wanted to do 20 images that would take  some time. So, I tried doing a for
>>> loop which didn't work exactly how I wanted it to work. I would like the
>>> program to take any amount of images and output them side by side , any ideas?
>>> The attachment shows the for loop I used similar to TileImageFilter
>>> CreateVolume example however when I use it for some odd reason only one image
>>> is being display side by side multiple times.
>>> 
>>> 
>>> 
>>> Daniel Mercik
>>> 
>>> Computer Science Major
>>> 
>>> Service Desk Technician
>>> 
>>> Thomas College
>>> 
>>> ________________________________
>>> From: Michka Popoff <michkapopoff at gmail.com <mailto:michkapopoff at gmail.com>>
>>> Sent: Wednesday, August 13, 2014 2:32 AM
>>> To: Dan Mercik
>>> Cc: ITK Mailing List;community at itk.org <mailto:community at itk.org>
>>> Subject: Re: [ITK-users] TileImageFilter SideBySide
>>> 
>>> Hi
>>> 
>>> 
>>> Moving this mail to the new community mailing list
>>> 
>>> 
>>> For your problem, you should use the setLayout method [1]
>>> 
>>> 
>>> For 4 images, that would be:
>>> 
>>> 
>>> 
>>> itk::FixedArray< unsigned int, 2 > layout;
>>> 
>>> layout[0] = 4;
>>> layout[1] = 0;
>>> 
>>> 
>>> Michka
>>> 
>>> 
>>> [1]
>>> http://www.itk.org/Wiki/ITK/Examples/ImageProcessing/TileImageFilter_SideBySide
>>> 
>>> On 13 ao?t 2014, at 01:06, Dan Mercik <mercikd at thomas.edu
>>> <mailto:mercikd at thomas.edu><mailto:mercikd at thomas.edu>> wrote:
>>> 
>>> Good Afternoon,
>>> 
>>> 
>>> 
>>>                  I want to know if it's possible to have more than two image
>>> be side by side vertically? If so what would I have to change in the
>>> algorithm, would I have to make a loop for the amount of input images? Any
>>> help would be greatly appreciative.
>>> 
>>> 
>>> 
>>> Daniel Mercik
>>> 
>>> Computer Science Major
>>> 
>>> Service Desk Technician
>>> 
>>> Thomas College
>>> _____________________________________
>>> Powered bywww.kitware.com <http://www.kitware.com/><http://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://public.kitware.com/mailman/listinfo/insight-users
>>> 
>>> <TileImageFilter_SideBySide.cxx><Tilesidebyside.JPG>
>> 
>> 
>> 
>> _____________________________________
>> 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://public.kitware.com/mailman/listinfo/insight-users
> 
> -- 
> Dr. Roman Grothausmann
> 
> Tomographie und Digitale Bildverarbeitung
> Tomography and Digital Image Analysis
> 
> Institut für Funktionelle und Angewandte Anatomie, OE 4120
> Medizinische Hochschule Hannover
> Carl-Neuberg-Str. 1
> D-30625 Hannover
> 
> Tel. +49 511 532-9574
> _____________________________________
> 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://public.kitware.com/mailman/listinfo/insight-users
_____________________________________
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://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list