<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"><<a href="mailto:tim.bhatnagar@gmail.com" target="_blank">tim.bhatnagar@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"><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's the source code:<br><br>#include "itkImage.h"<br>#include "itkImageSeriesReader.h"<br>#include "itkImageFileWriter.h"<br>#include "itkNumericSeriesFileNames.h"<br>
#include "itkPNGImageIO.h"<br>#include "itkVTKImageIO.h"<br>#include "itkChangeInformationImageFilter.h"<br><br><br><br>int main( int argc, char ** argv )<br>{<br><br> if( argc < 4 )<br>
{<br>
std::cerr << "Usage: " << std::endl;<br> std::cerr << argv[0] << " firstSliceValue lastSliceValue filenamePrefix outputImageSuffix " << std::endl;<br> return EXIT_FAILURE;<br>
}<br><br><br> typedef unsigned short PixelType;<br> const unsigned int Dimension = 3;<br> typedef itk::Vector< float, 3 > Vector3DType;<br> typedef itk::Image< Vector3DType, 2 > VectorImage2DType;<br>
<br> typedef itk::Image< Vector3DType, Dimension > VectorImage3DType;<br> <br> typedef itk::ImageSeriesReader< VectorImage3DType > ReaderType;<br> typedef itk::ImageFileWriter< VectorImage3DType > 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 += "%02d.vtk";<br> std::string format2 = argv[3];<br> format2 += argv[4];<br> <br> std::cerr << (format2.c_str() );<br><br><br> typedef itk::NumericSeriesFileNames NameGeneratorType;<br>
<br> NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();<br><br> nameGenerator->SetSeriesFormat( format.c_str() );<br><br> nameGenerator->SetStartIndex( first );<br> nameGenerator->SetEndIndex( last );<br>
nameGenerator->SetIncrementIndex( 1 );<br><br><br> reader->SetImageIO( itk::VTKImageIO::New() );<br><br> reader->SetFileNames( nameGenerator->GetFileNames() );<br><br> writer->SetFileName( format2.c_str() );<br>
<br><br> typedef itk::ImageFileReader< VectorImage3DType > RefImageReaderType;<br><br> RefImageReaderType::Pointer reference = RefImageReaderType::New();<br><br> reference->SetFileName( "48Slice-refField.vtk" ); // this is a reference file I have designed<br>
<br> typedef itk::ChangeInformationImageFilter<<br> VectorImage3DType > ChangeInformationImageFilterType;<br><br> ChangeInformationImageFilterType::Pointer changer = ChangeInformationImageFilterType::New();<br>
<br> changer->UseReferenceImageOn();<br> changer->SetReferenceImage( reference->GetOutput() );<br> changer->SetInput( reader->GetOutput() );<br> changer->ChangeSpacingOn();<br><br> writer->SetInput( changer->GetOutput() );<br>
<br> try<br> {<br> writer->Update();<br> }<br> catch( itk::ExceptionObject & err )<br> {<br> std::cerr << "ExceptionObject caught !" << std::endl;<br> std::cerr << err << 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"><<a href="mailto:xiaoxiao.liu@kitware.com" target="_blank">xiaoxiao.liu@kitware.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, <div>There seem to be something different in this this last dataset than your other datasets?</div>
<div><div>It'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"><<a href="mailto:tim.bhatnagar@gmail.com" target="_blank">tim.bhatnagar@gmail.com</a>></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'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 & 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>