<div dir="ltr">Hi David, thank you for your suggestion.<br><br>actually I don't know how to generate a dummy image that has the following properties:<br><br>Input image:<br>PixelType: unsigned short<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
Dimension: 3</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> Dimensions: 202 419 157 </p><p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> IndexToWorldTransform: </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> Matrix: </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> 0.488281 0 0 </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> -0 -0.488281 0 </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> -0 0 1 </p>
<p style="margin:0px;text-indent:0px"><br> </p><p style="margin:0px;text-indent:0px"><br></p><p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">and in addition to my code below:<br>
</p><br>#define myDimension 3<br>#define vectorLength 3<br><br><br>Sorry I can't help you a lot ...<br><br><br><br><div class="gmail_quote">On Fri, May 18, 2012 at 3:09 PM, David Doria <span dir="ltr"><<a href="mailto:daviddoria@gmail.com" target="_blank">daviddoria@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div><div class="h5">On Fri, May 18, 2012 at 5:46 AM, Hila Hiler <span dir="ltr"><<a href="mailto:hilahiler@gmail.com" target="_blank">hilahiler@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi,<br><br>I'm trying to generate a vector image with the same dimensions and region as another image that I have.<br>a RT error about itkSmartPoint/ memory failure are stopping me from get this vector image<br>
<br>Here is my code, I really lost of ideas why it's happening here.<br><br>Thanks in advance.<br><br><br>my code:<br><br><br>typedef double pixelType;<br>typedef itk::Image < pixelType, myDimension > ImageType;<br>
<br>//vector Type<br>typedef itk::VectorImage < pixelType, myDimension > vectorImageType;<br><br>vectorImageType::Pointer vectorImage = vectorImageType::New();<br>ImageType::Pointer myItkImg;<br><br>//...some manipulation on myItkImg (initializing and assigning data))<br>
<br>1) first try is: <br><br> itk::CastImageFilter<ImageType,vectorImageType>::Pointer caster = itk::CastImageFilter<ImageType,vectorImageType>::New();<br><br> //cast to vector img<br> caster->SetInput(myItkImg);<br>
caster->Update();<br> vectorImage = caster->GetOutput();<br> vectorImage->SetVectorLength(vectorLength);<br> vectorImage->Allocate(); <b>//here the RT occurs</b><br><br><b>/*RT stop at this itk's internal code:</b><br>
void UnRegister()<br> {<br> if(m_Pointer) { m_Pointer->UnRegister(); }<br> }<br>*/<br><br> <br>2) second try:<br><br> vectorImageType::SizeType size;<br> <br> size[0]=myItkImg->GetDimension(0);<br>
size[1]=myItkImg->GetDimension(1);<br> size[2]=myItkImg->GetDimension(2);<br><br> ImageType::SpacingType img_spacing= myItkImg->GetSpacing();<br> vectorImageType::SpacingType vec_spacing;<br><br> vec_spacing[0]= img_spacing[0];<br>
vec_spacing[1]= img_spacing[1];<br> vec_spacing[2]= img_spacing[2];<br> <br> vectorImageType::IndexType start;<br> start.Fill(0);<br><br> vectorImageType::RegionType region(start,size);<br> vectorImage->SetSpacing(vec_spacing);<br>
vectorImage->SetRegions(region);<br> vectorImage->SetVectorLength(vectorLength);<br> vectorImage->Allocate(); <b>//here the RT occurs</b><br>/*<br><b>RT stop at this itk's internal code:</b><br> itkDebugMacro (<< "Setting imageIO IORegion to: " << m_ActualIORegion ); <br>
m_ImageIO->SetIORegion( m_ActualIORegion );<br>*/</div></blockquote><div><br></div></div></div>Please make compilable examples. It is only a few more lines to produce some dummy data and include the necessary headers. The idea is that then we can copy/paste/compile and see the error.<span class="HOEnZb"><font color="#888888"><br clear="all">
<br>David </font></span></div><br>
</blockquote></div><br></div>