<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello,<div><br></div><div>What is the error you are getting? Is it runtime or compilation time?</div><div><br></div><div>Here is the internal execute method from SimpleITK, I hope it's straight forward enough for an example:</div><div><br></div><div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;">template <class TImageType></span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;">Image JoinSeriesImageFilter::ExecuteInternal ( const std::vector<Image> &images )</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;">{</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> // Define the input and output image types</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> typedef TImageType InputImageType;</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> </span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> //Define output image type</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> typedef typename InputImageType::template Rebind<typename InputImageType::PixelType, InputImageType::ImageDimension+1>::Type OutputImageType;</span></font></div><div><br></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> typedef itk::JoinSeriesImageFilter<InputImageType, OutputImageType> FilterType;</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> // Set up the ITK filter</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> typename FilterType::Pointer filter = FilterType::New();</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"><br></span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> for ( unsigned int i = 0; i < images.size(); ++i )</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> {</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> // Get the pointer to the ITK image contained in image1</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> typename InputImageType::ConstPointer image = this->CastImageToITK<InputImageType>( images[i] );</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"><br></span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> filter->SetInput( i, image );</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> }</span></font></div><div><br></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> filter->SetOrigin ( this->m_Origin );</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> filter->SetSpacing ( this->m_Spacing );</span></font></div><div><br></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> if (this->GetDebug())</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> {</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> std::cout << "Executing ITK filter:" << std::endl;</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> std::cout << filter;</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> }</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"><br></span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> // Run the ITK filter and return the output as a SimpleITK image</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> filter->Update();</span></font></div><div><br></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> typename FilterType::OutputImageType *itkOutImage = filter->GetOutput();</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> this->FixNonZeroIndex( itkOutImage );</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> return Image( itkOutImage );</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 15px;"> }</span></font></div></div><div><br></div><div><br></div><div>Good luck,</div><div>Brad</div><div><br><div><div>On Sep 26, 2013, at 11:03 AM, shiwei <<a href="mailto:swingsw89@163.com">swingsw89@163.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><div style="line-height: 1.7; font-size: 14px; font-family: arial; ">Hi!<div> I stil have a problem when using the "iitkJoinImageFilter".</div><div> Here is the thing:</div><div> typedef itk::Image< double, 2 > ImageType2D; // defying the Readertype,they are 2D slices</div><div> typedef itk::Image< double,3 > ImageType3D; // the 3D volume which I want to get from the JoinImageFilter</div><div><br></div><div> As I read a series of 2D slices with a "for" loop,then after processing them , I use JoinImageFilter to get a 3D output, then I had a problem:</div><div><br></div><div> typedef itk::JoinImageFilter<ImageType2D, ImageType3D> JoinImageFilterType;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> JoinImageFilterType::Pointer joinFilter = JoinImageFilterType::New();</div><div><br></div><div> for(int slice=0;slice<10,slice++)</div><div>{</div><div> .........read the 2D slice...........</div><div> ..........processing............</div><div> ...........2D output Image......</div><div> joinFilter->SetInput(slice,outputImage);</div><div>}</div><div> joinFilter->update;</div><div><br></div><div>But after I did this ,vs comes out an error says itk can't convert from 2D to 3D, If it's convienient can you show me an example like this with the <span style="line-height: 1.7;">"iitkJoinImageFilter"? To show me how to make this right? Thank you! Also,if I want to test whether I get a proper 3D volume,what shall I do then? </span></div><div><br></div><div> </div><div><br><br><br><br><div></div><div id="divNeteaseMailCard"></div><br>At 2013-09-25 14:23:27,shiwei <<a href="mailto:swingsw89@163.com">swingsw89@163.com</a>> wrote:<br> <blockquote id="isReplyContent" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><div style="line-height: 1.7; font-size: 14px; font-family: arial; ">Thank you very much! Brad!<div><br></div><div> shiwei<br><br><br><br><br><div></div><div></div><br>At 2013-09-25 00:00:50,"Bradley Lowekamp" <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>> wrote:<br> <blockquote id="isReplyContent" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><div>Hello,</div><div><br></div><div>To join a series of 2D image into a 3D volume you can you the JoinImageFilter:</div><div><a href="http://www.itk.org/Insight/Doxygen/html/classitk_1_1JoinImageFilter.html">http://www.itk.org/Insight/Doxygen/html/classitk_1_1JoinImageFilter.html</a></div><div><br></div><div>The extract a 2D image from a 3D volume you can use the ExtractImageFilter:</div><div><a href="http://www.itk.org/Doxygen/html/classitk_1_1ExtractImageFilter.html">http://www.itk.org/Doxygen/html/classitk_1_1ExtractImageFilter.html</a></div><div><br></div><div>To extract a 3D volume from a 3D volume there are a few filter:</div><div><a href="http://www.itk.org/Doxygen/html/classitk_1_1ExtractImageFilter.html">http://www.itk.org/Doxygen/html/classitk_1_1ExtractImageFilter.html</a></div><div><a href="http://www.itk.org/Doxygen/html/classitk_1_1RegionOfInterestImageFilter.html">http://www.itk.org/Doxygen/html/classitk_1_1RegionOfInterestImageFilter.html</a></div><div><a href="http://www.itk.org/Doxygen/html/classitk_1_1CropImageFilter.html">http://www.itk.org/Doxygen/html/classitk_1_1CropImageFilter.html</a></div><div><br></div><div>Hope that helps,</div><div>Brad</div><br><div><div>On Sep 24, 2013, at 11:14 AM, shiwei <<a href="mailto:swingsw89@163.com">swingsw89@163.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="line-height: 1.7; font-size: 14px; font-family: arial; ">Hi,all~<div><span class="Apple-tab-span" style="white-space:pre">        </span>As I first read a 3D Image Volume slice by slice,then after processing each slice I need to change them to a 3D volume for further processing, However,<b> I can't use itk::ImageSeriesReader</b> for my pixeltype now is double and it takes to much time to write out the 2D image first.</div><div> I wonder if there is a class to help me read the 2D slices directly to 3D volume just in the memory.Also, I still eager to know whether there is a class can direclty extract a part of 3D volume from a bigger one.Beacuse IF there is no way to deal with that ,I will have to change all the 2D images to 2D Array then combine them to 3D Array which I think may take a lot of time.</div><div> Do you have any way to figure this out? Thank you all !</div></div><br><br><span title="neteasefoote
r"><span id="netease_mail_footer"></span></span>_____________________________________<br>Powered by <a href="http://www.kitware.com/">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html">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">http://www.kitware.com/products/protraining.php</a><br><br>Please keep messages on-topic and check the ITK FAQ at:<br>http://www.itk.org/Wiki/ITK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://www.itk.org/mailman/listinfo/insight-users<br></blockquote></div><br></blockquote></div></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span></blockquote></div></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span></blockquote></div><br></div></body></html>