<div> I have tried itkVectorResampleImageFilter. Now my code can be complied,<br> however, I still get the following error message when I run the program:</div>
<div><br> itk::ExceptionObject (010DF768)<br> Location: "class itk::Vector<float,3> *__thiscall<br> itk::ImportImageContainer<unsi<br> gned long,class itk::Vector<float,3> >::AllocateElements(unsigned long)<br>
const"<br> File: c:\itk\insighttoolkit-3.10.1\code\common\itkImportImageContainer.txx<br> Line: 194<br> Description: Failed to allocate memory for image.</div>
<div><br> The image file I am running is 512x512x46 (~25M). I slightly extracted the<br> file into 22M and obtained a deform field (DF.mhd) of 62M. I tried the<br> itkVectorResampleImageFilter to restored the deform field (DF_EX.mhd) to<br>
orginal size (physical size) but with less resolution. Theoretically<br> DF_EX.mhd is less size (in memory) than DF.mhd. How come I still get the<br> "Failed to allocate memory for image"?<br> Attached is my code to resample the vector field.<br>
Regards,<br> Howard<br><br></div>
<div class="gmail_quote">On Sun, Feb 15, 2009 at 7:57 AM, Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Try itkVectorResampleImageFilter.<br><br>Examples/Filtering/ResampleImageFilter9.cxx illustrates the class.<br>
<div>
<div></div>
<div class="Wj3C7c"><br>On Sat, Feb 14, 2009 at 4:11 PM, Hsiang-Chi Kuo <<a href="mailto:kuoxgx@gmail.com">kuoxgx@gmail.com</a>> wrote:<br>> Hi,<br>><br>> I am working on a deformable registration program with the diffeomorphic<br>
> Demons registration filter. Due to the memory issue, I have to apply the<br>> region of interest filer to the input image such that I can run the<br>> program and get the deform field. Then I tried to use resample image filter<br>
> to<br>> restore the size of the deform field back to the original size of the<br>> input image. First, the resample image filter dose not allow me to set the<br>> default pixel to zero. If I by pass the setting of the background to<br>
> zero, it turn out the attached error message.<br>> Dose the resample image filter support vector field? If not, any way I<br>> can solve my problem? Bellowed please also find part of my code.<br>> Thanks and regards,<br>
> Howard<br>><br>> typedef itk::Image< VectorPixelType, Dimension > DeformationFieldType;<br>> typedef itk::ImageFileWriter< DeformationFieldType > FieldWriterType;<br>><br>> typename FieldWriterType::Pointer fieldWriter = FieldWriterType::New();<br>
> fieldWriter->SetFileName( args.outputFieldFile0.c_str() );<br>><br>> typedef<br>> itk::ResampleImageFilter<DeformationFieldType,DeformationFieldType><br>> FilterType;<br>> FilterType::Pointer resampleFilter = FilterType::New();<br>
><br>> typedef itk::AffineTransform< double, Dimension > TransformType;<br>><br>> TransformType::Pointer transform = TransformType::New();<br>> resampleFilter->SetTransform( transform );<br>
><br>> typedef itk::NearestNeighborInterpolateImageFunction<<br>> DeformationFieldType, double > InterpolatorType;<br>><br>> InterpolatorType::Pointer interpolator = InterpolatorType::New();<br>
> resampleFilter->SetInterpolator( interpolator );<br>><br>> //resampleFilter->SetDefaultPixelValue( 0 );<br>><br>> typename ImageType::Pointer outputImage = 0;<br>> outputImage = outputImageReader -> GetOutput();<br>
> resampleFilter->SetSize(<br>> outputImage->GetLargestPossibleRegion().GetSize() );<br>> resampleFilter->SetInput( defField );<br>> fieldWriter->SetInput( resampleFilter->GetOutput() );<br>
> fieldWriter->SetUseCompression( true );<br>><br>> try<br>> {<br>> fieldWriter->Update();<br>> }<br>> catch( itk::ExceptionObject& err )<br>> {<br>> std::cout << "Unexpected error." << std::endl;<br>
> std::cout << err << std::endl;<br>> exit( EXIT_FAILURE );<br>> }<br></div></div>> _____________________________________<br>> Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br>
><br>> Visit other Kitware open-source projects at<br>> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>><br>> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>><br>> Follow this link to subscribe/unsubscribe:<br>> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
><br>><br></blockquote></div><br>