<div dir="ltr"><div><div>Ah... my reference file is not the same size as this current data set.. apparently just by chance!<br><br></div>Bingo - that was the issue.<br><br></div>Sorry for the trouble, and thanks for responding!<br>
<br>Tim<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Sep 4, 2013 at 9:33 AM, Tim Bhatnagar <span dir="ltr">&lt;<a href="mailto:tim.bhatnagar@gmail.com" target="_blank">tim.bhatnagar@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>well, the individual files are displacement fields that were output from the ImageRegistration5 routine.<br>
<br></div>The deformation vector magnitudes will most assuredly be different than other sets, but the type of information and file are the same..<br>
<br></div>Here&#39;s the source code:<br><br>#include &quot;itkImage.h&quot;<br>#include &quot;itkImageSeriesReader.h&quot;<br>#include &quot;itkImageFileWriter.h&quot;<br>#include &quot;itkNumericSeriesFileNames.h&quot;<br>

#include &quot;itkPNGImageIO.h&quot;<br>#include &quot;itkVTKImageIO.h&quot;<br>#include &quot;itkChangeInformationImageFilter.h&quot;<br><br><br><br>int main( int argc, char ** argv )<br>{<br><br>  if( argc &lt; 4 )<br>
    {<br>
    std::cerr &lt;&lt; &quot;Usage: &quot; &lt;&lt; std::endl;<br>    std::cerr &lt;&lt; argv[0] &lt;&lt; &quot; firstSliceValue lastSliceValue  filenamePrefix  outputImageSuffix &quot; &lt;&lt; std::endl;<br>    return EXIT_FAILURE;<br>

    }<br><br><br>  typedef unsigned short                       PixelType;<br>  const unsigned int Dimension = 3;<br>  typedef itk::Vector&lt; float,       3 &gt;  Vector3DType;<br>  typedef itk::Image&lt; Vector3DType, 2 &gt;  VectorImage2DType;<br>

<br>  typedef itk::Image&lt; Vector3DType, Dimension &gt;  VectorImage3DType;<br> <br>  typedef itk::ImageSeriesReader&lt; VectorImage3DType &gt;  ReaderType;<br>  typedef itk::ImageFileWriter&lt;   VectorImage3DType &gt;  WriterType;<br>

<br>  ReaderType::Pointer reader = ReaderType::New();<br>  WriterType::Pointer writer = WriterType::New();<br><br><br>  const unsigned int first = atoi( argv[1] );<br>  const unsigned int last  = atoi( argv[2] );<br><br>
  const char * outputFilesuffix = argv[4];<br>
<br>  std::string format = argv[3];<br>  format += &quot;%02d.vtk&quot;;<br>  std::string format2 = argv[3];<br>  format2 += argv[4];<br> <br>  std::cerr &lt;&lt; (format2.c_str() );<br><br><br>  typedef itk::NumericSeriesFileNames    NameGeneratorType;<br>

<br>  NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();<br><br>  nameGenerator-&gt;SetSeriesFormat( format.c_str() );<br><br>  nameGenerator-&gt;SetStartIndex( first );<br>  nameGenerator-&gt;SetEndIndex( last );<br>

  nameGenerator-&gt;SetIncrementIndex( 1 );<br><br><br>  reader-&gt;SetImageIO( itk::VTKImageIO::New() );<br><br>  reader-&gt;SetFileNames( nameGenerator-&gt;GetFileNames()  );<br><br>  writer-&gt;SetFileName( format2.c_str() );<br>

<br><br>  typedef itk::ImageFileReader&lt; VectorImage3DType  &gt; RefImageReaderType;<br><br>  RefImageReaderType::Pointer reference = RefImageReaderType::New();<br><br>  reference-&gt;SetFileName( &quot;48Slice-refField.vtk&quot; ); // this is a reference file I have designed<br>

<br>  typedef itk::ChangeInformationImageFilter&lt;<br>                            VectorImage3DType &gt;    ChangeInformationImageFilterType;<br><br>  ChangeInformationImageFilterType::Pointer changer = ChangeInformationImageFilterType::New();<br>

<br>  changer-&gt;UseReferenceImageOn();<br>  changer-&gt;SetReferenceImage( reference-&gt;GetOutput() );<br>  changer-&gt;SetInput( reader-&gt;GetOutput() );<br>  changer-&gt;ChangeSpacingOn();<br><br>  writer-&gt;SetInput( changer-&gt;GetOutput() );<br>

<br>  try<br>    {<br>    writer-&gt;Update();<br>    }<br>  catch( itk::ExceptionObject &amp; err )<br>    {<br>    std::cerr &lt;&lt; &quot;ExceptionObject caught !&quot; &lt;&lt; std::endl;<br>    std::cerr &lt;&lt; err &lt;&lt; std::endl;<br>

    return EXIT_FAILURE;<br>    }<br><br><br>  return EXIT_SUCCESS;<br>}<br><br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Sep 4, 2013 at 9:28 AM, Xiaoxiao Liu <span dir="ltr">&lt;<a href="mailto:xiaoxiao.liu@kitware.com" target="_blank">xiaoxiao.liu@kitware.com</a>&gt;</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, <div>There  seem to be something different in this this last dataset than your other datasets?</div>

<div><div>It&#39;s better to post the source code with the question so that others could help the diagnosis.</div>
<div>Thanks.</div><div><br></div><div>-Xiaoxiao</div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Wed, Sep 4, 2013 at 12:16 PM, Tim Bhatnagar <span dir="ltr">&lt;<a href="mailto:tim.bhatnagar@gmail.com" target="_blank">tim.bhatnagar@gmail.com</a>&gt;</span> wrote:<br>


</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div><div><div><div>Hello,<br><br></div>I am combining a number of vector-component 2D images into a 3D volume, using ImageSeriesReadWrite.<br>


<br></div>The work has been going fine, but with my last sample set, I am receiving an error:<br>
<br>requested region is outside largest possible region itk<br><br></div>Reading some old nabble ITK, I thought this type of error had been addressed by having an automatic implementation of UpdateLargestPossibleRegion(), but I&#39;m seeing it here.<br>



<br></div>Because this is only occurring on my last dataset (the others functioned just fine), could someone help me in terms of what to look for/change?<br><br>thanks,<br clear="all"><div><div><div><div><div><br>-- <br>


Tim Bhatnagar<br>
PhD Candidate<br>Orthopaedic Injury Biomechanics Group<br>Department of Mechanical Engineering<br>University of British Columbia<br><br>Rm 5000 - 818 West 10th Ave.<br>Vancouver, BC<br>Canada<br>V5Z 1M9<br><br>Ph: <a href="tel:%28604%29%20675-8845" value="+16046758845" target="_blank">(604) 675-8845</a><br>



Fax: <a href="tel:%28604%29%20675-8820" value="+16046758820" target="_blank">(604) 675-8820</a><br>Web: <a href="http://oibg.mech.ubc.ca" target="_blank">oibg.mech.ubc.ca</a><br>
</div></div></div></div></div></div>
<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>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</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></blockquote></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div><br></div><div><br></div>---------------------------------------------<br><b>Xiaoxiao Liu</b>, Ph.D.<div><div>
<div><font face="arial, sans-serif"><span style="border-collapse:collapse">R &amp; D Engineer</span></font></div>
<div><div><a href="http://www.kitware.com/" target="_blank">Kitware Inc</a>.</div></div><div><span style="border-collapse:collapse;font-family:arial,sans-serif;font-size:13px">Clifton Park, NY</span><div><div>Phone: <a href="tel:%28518%29%20881-4924" value="+15188814924" target="_blank">(518) 881-4924</a>  or  <span style="border-collapse:collapse;color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px"><a href="tel:%28518%29%20371-3971%20x124" value="+15183713971" target="_blank">(518) 371-3971 x124</a></span></div>


<div><font face="Verdana, Arial, Helvetica, sans-serif"><span style="line-height:31px;font-size:x-small"><br></span></font></div></div></div></div></div>
</font></span></div>
</blockquote></div><br><br clear="all"><br>-- <br>Tim Bhatnagar<br>PhD Candidate<br>Orthopaedic Injury Biomechanics Group<br>Department of Mechanical Engineering<br>University of British Columbia<br><br>Rm 5000 - 818 West 10th Ave.<br>

Vancouver, BC<br>Canada<br>V5Z 1M9<br><br>Ph: <a href="tel:%28604%29%20675-8845" value="+16046758845" target="_blank">(604) 675-8845</a><br>Fax: <a href="tel:%28604%29%20675-8820" value="+16046758820" target="_blank">(604) 675-8820</a><br>
Web: <a href="http://oibg.mech.ubc.ca" target="_blank">oibg.mech.ubc.ca</a><br>
</div>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Tim Bhatnagar<br>PhD Candidate<br>Orthopaedic Injury Biomechanics Group<br>Department of Mechanical Engineering<br>University of British Columbia<br><br>Rm 5000 - 818 West 10th Ave.<br>
Vancouver, BC<br>Canada<br>V5Z 1M9<br><br>Ph: (604) 675-8845<br>Fax: (604) 675-8820<br>Web: <a href="http://oibg.mech.ubc.ca" target="_blank">oibg.mech.ubc.ca</a><br>
</div>