[Insight-users] Problem with Fast marching minimal path extraction

Dan Mueller dan.muel at gmail.com
Tue Apr 27 01:29:02 EDT 2010


Hi Martijn,

I am not a VTK expert, but your code seems correct. You can easily
verify this yourself by using an itkImageFileWriter to write "speed"
to disk (using say MHD file format).

A 512^3 floating point image is 512MB, so I would expect you to be
able to hold at least three (3) copies of this image in memory for a
32-bit Windows process. If you think memory is an issue, then you may
consider disposing of all unneeded references before performing the
minimal path extraction.

Of course, if you don't want to think too carefully about your memory
usage, you can simply switch to 64-bi :D

HTH

Cheers, Dan

On 26 April 2010 21:58, Martijn Steenwijk <martijnsteenwijk at gmail.com> wrote:
> Hi Dan,
>
> You were right. Changing the 2 to 3 solved the error for that file... which
> introduces another problem. I would like to extract the shortest path from
> vtk (vtkImageData). So, I use the following code to convert the vtkImageData
> to Image<3>
>
> const unsigned int Dimension = 3;
> typedef float PixelType;
> typedef unsigned char OutputPixelType;
> typedef itk::Image< PixelType, Dimension > ImageType;
> typedef itk::VTKImageToImageFilter<ImageType> VTK2ITKConnectorType;
>
> // Convert the vtkImageData to itkImage
> VTK2ITKConnectorType::Pointer v2iConnector = VTK2ITKConnectorType::New();
> v2iConnector->SetInput(out);
> v2iConnector->GetImporter()->Update();
> v2iConnector->Update();
> ImageType::ConstPointer speed = v2iConnector->GetOutput();
>
> This still gives the same kind of errors as mentioned in the first post.
> Actually, the image which I want to load is 512*512*516 float, so it think
> that this is not gonna work on win32 due to memory issues. Or, do you think
> there's a problem with the code above?
>
> Thanks for your reply in advance,
> Martijn
>
> ---
> Martijn Steenwijk
> T 06 20693913
> E martijnsteenwijk at gmail.com
>
> -----Original Message-----
> From: Dan Mueller [mailto:dan.muel at gmail.com]
> Sent: zondag 25 april 2010 16:47
> To: martijnsteenwijk at gmail.com
> Cc: insight-users at itk.org
> Subject: Re: [Insight-users] Problem with Fast marching minimal path
> extraction
>
> Hi Martijn,
>
> Just taking a look at the code of examples.cxx again -- ugg. I wrote
> this over 2 years ago when I was still an ITK noob...
>
> I notice that in examples.cxx the dimension is hard-coded as a const
> (see lines 28 or 132). This hard-coded value is "2";
> Synthetic-04-Speed.mhd is a 3-d image. Did you change the dimension to
> "3"? I think this could be the issue... If I was writing the code
> again I would have allowed users to choose the dimension at
> run-time...
>
> Let us know if this works for you.
>
> Cheers, Dan
>
> On 25 April 2010 10:38, Martijn Steenwijk <martijnsteenwijk at gmail.com>
> wrote:
>> Hi Dan,
>>
>> Thanks for your reply. I compiled the project as provided 'out-of-the-box'
>> and tried to compute some paths. It works fine for all provided speed
>> images, exept the file 'Synthetic-04-Speed.mhd'. Then I'm getting an error
>> again. I attached a  screenshot of the error to this mail.
>> It's exactly the same when I try to 'handle' the provided speed images
> with
>> the my own software. It works fine for all images, except the image
>> 'Synthetic-04-Speed.mhd'. I'm somehow getting the feeling that it has
>> something to do with memory issues. I'm currently compiling 32-bit, but
> I'll
>> try 64.
>> If you think the problem is something else, please let me know.
>>
>> Best regards,
>> Martijn
>>
>>
>> ---
>> Martijn Steenwijk
>> T 06 20693913
>> E martijnsteenwijk at gmail.com
>>
>>
>> -----Original Message-----
>> From: Dan Mueller [mailto:dan.muel at gmail.com]
>> Sent: zondag 25 april 2010 5:05
>> To: martijnsteenwijk at gmail.com
>> Cc: insight-users at itk.org
>> Subject: Re: [Insight-users] Problem with Fast marching minimal path
>> extraction
>>
>> Hi Martijn,
>>
>> When you say you are using the "exact same pipeline as the example",
>> do you also mean the same input image? I see that the program you are
>> using is called "carotid.exe" so I assume you are using the filter
>> within your own program...? Is it possible to reproduce the issue with
>> the example "out-of-the-box" ie. with absolutely no modifications to
>> the source code?
>>
>> This could be an issue with either:
>>    (1) ITK 3.18 -- I will test this in the coming days.
>>    (2) Windows 7 -- I have no way of testing this, as I work with
>> Windows XP and Cygwin.
>>        Can you reproduce the issue on Windows XP?
>>    (3) 64-bit -- Again, I have no way of testing this. Are you
>> compiling for 32-bit or 64-bit?
>>    (4) input image -- If you are using a different input image than
>> the ones provided,
>>        it could be input image causing the issue...
>>
>> Regards, Dan
>>
>> On 24 April 2010 19:42, Martijn Steenwijk <martijnsteenwijk at gmail.com>
>> wrote:
>>> Dear all,
>>>
>>>
>>>
>>> I'm trying to integrate the 'Fast marching minimal path
>>> extraction'-technique in my software as provided by
>>> http://www.insight-journal.org/browse/publication/213 . I'm using exactly
>>> the same pipeline as is used in the provided 'examples.cxx'. I'm getting
>> an
>>> error however, while executing the line
>>>
>>>
>>>
>>> // Compute the path
>>>
>>> pathFilter->Update();
>>>
>>>
>>>
>>> The following error is shown:
>>>
>>> First-chance exception at 0x768eb727 in carotid.exe: Microsoft C++
>>> exception: std::bad_alloc at memory location 0x004be668..
>>>
>>> First-chance exception at 0x768eb727 in carotid.exe: Microsoft C++
>>> exception: itk::MemoryAllocationError at memory location 0x004be708..
>>>
>>> First-chance exception at 0x768eb727 in carotid.exe: Microsoft C++
>>> exception: itk::ExceptionObject at memory location 0x004beabc..
>>>
>>> First-chance exception at 0x768eb727 in carotid.exe: Microsoft C++
>>> exception: itk::ExceptionObject at memory location 0x004bf1fc..
>>>
>>>
>>>
>>> I'm using ITK 3.18.0, visual studio 2008 on a windows 7 64 bit machine.
>>> Could anyone help me to find out where this error comes from? Thanks for
>>> replies in advance.
>>>
>>>
>>>
>>> Best,
>>>
>>> Martijn
>>>
>>>
>>>
>>> ---
>>>
>>> Martijn Steenwijk
>>>
>>> T 06 20693913
>>>
>>> E martijnsteenwijk at gmail.com
>>
>
>


More information about the Insight-users mailing list