<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:PMingLiU;
        panose-1:2 2 5 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Cambria;
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:PMingLiU;
        panose-1:2 2 5 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=ZH-TW link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='font-family:"Cambria","serif"'>Hi,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Cambria","serif"'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Cambria","serif"'>It works! Thank you very much.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Cambria","serif"'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Cambria","serif"'>Now there’s another problem. If I want to combine them back to a vector after doing some processing on each component, it seems a good idea to use itkImageToVectorImageFilter.h. However, the original vector image is of </span><i><span lang=EN-US style='font-family:"Cambria","serif"'>itk::Image< itk::Vector<float, 6>, 3 ></span></i><span lang=EN-US style='font-family:"Cambria","serif"'> type, while the output image of the filter is of itk::VectorImage type. They are essentially different in their way of storing components. Is there a way to make them consistent? Say, casting VectorImage to Image<Vector<float, 6>, 3> or another filter that works the same but gives Image<Vector<float, 6>, 3> as output.</span><span lang=EN-US style='font-family:"Cambria","serif"'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Calibri","sans-serif";color:#1F497D'>Best regards,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Calibri","sans-serif";color:#1F497D'>Meng-Kang Hsieh (Michael)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Calibri","sans-serif";color:#1F497D'>OpSciTech, Erasmus Mundus<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Calibri","sans-serif";color:#1F497D'>Delft University of Technology<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> wanlin [mailto:wanlinzhu@gmail.com] <br><b>Sent:</b> Saturday, March 26, 2011 2:44 AM<br><b>To:</b> Hsieh<br><b>Cc:</b> Luis Ibanez; insight-users@itk.org<br><b>Subject:</b> Re: [Insight-users] Problem in reading nifti image<o:p></o:p></span></p></div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal style='margin-bottom:12.0pt'><span lang=EN-US>HI, Michael<br> If your output image is the last selectorIndex component of input vectorimage, you might need disconnect the output image before proceed on. See embedded lines.<o:p></o:p></span></p><div><p class=MsoNormal><span lang=EN-US>On Sat, Mar 26, 2011 at 1:50 AM, Hsieh <<a href="mailto:M.Hsieh@student.tudelft.nl">M.Hsieh@student.tudelft.nl</a>> wrote:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Hi Luis,<br><br>This is a very helpful message that this filter does exactly what I need.<br><br>But, I am wondering if I can use only one instance of the filter to generate multiple output by setting different index? I've tried something as below,<br> int selectorIndex = 0;<br> selector->SetIndex( selectorIndex );<o:p></o:p></span></p><div><p class=MsoNormal><span lang=EN-US> selector->Update();<br>ScalarImagePointer output0 = selector->GetOutput();<br>output0->DisconnectPipeline();<o:p></o:p></span></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm'><p class=MsoNormal><span lang=EN-US> writer0->SetInput( output0);<br> selectorIndex++;<br><br> selector->SetIndex( selectorIndex );<o:p></o:p></span></p></blockquote><div><p class=MsoNormal><span lang=EN-US> selector->Update();<br>ScalarImagePointer output1 = selector->GetOutput();<br>output1->DisconnectPipeline();<o:p></o:p></span></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm'><p class=MsoNormal><span lang=EN-US> writer1->SetInput( output1);<br> selectorIndex++;<br><br>and so on. But all the writers give the same component of the tensor image. Instead, I have to instantiate 6 selectors as many as the writers to achieve the goal of saving six components of a DTI tensor image.<br>However, I'd like to have a single class and one instance that can produce multiple outputs, say, extract all six components in the tensor like:<br> selector->GetComponentOne( );<br> selector->GetComponentTwo( );<br>and so on.<br>Do you think that I have to write a new class capable of multiple outputs inherited from the itkVectorIndexSelectionCastImageFilter? Or any simpler way?<o:p></o:p></span></p><div><p class=MsoNormal style='margin-bottom:12.0pt'><span lang=EN-US><br><br><br>Best regards,<br>Meng-Kang Hsieh (Michael)<br><br><o:p></o:p></span></p></div><div><div><p class=MsoNormal><span lang=EN-US>-----Original Message-----<br>From: Luis Ibanez [mailto:<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>]<br>Sent: Tuesday, February 22, 2011 12:54 AM<br>To: robert tamburo<br>Cc: Hsieh; <a href="mailto:insight-users@itk.org">insight-users@itk.org</a>; <a href="mailto:norman-k-williams@uiowa.edu">norman-k-williams@uiowa.edu</a><br>Subject: Re: [Insight-users] Problem in reading nifti image<br><br>Hi Michael<br><br>As Robert described, the ImageAdaptor will not work before a Writer.<br><br>You may want to use instead the filter:<br><br><a href="http://public.kitware.com/Insight/Doxygen/html/classitk_1_1VectorIndexSelectionCastImageFilter.html" target="_blank">http://public.kitware.com/Insight/Doxygen/html/classitk_1_1VectorIndexSelectionCastImageFilter.html</a><br><br><br> Luis<br><br><br>---------------------------------<br>On Mon, Feb 21, 2011 at 2:06 PM, robert tamburo<br><<a href="mailto:robert.tamburo@gmail.com">robert.tamburo@gmail.com</a>> wrote:<br>> Section 12.5 of the ITK software guide:<br>> 12.5 Adaptors and Writers<br>> Image adaptors will not behave correctly when connected directly to a<br>> writer. The reason is<br>> that writers tend to get direct access to the image buffer from their input,<br>> since image adaptors<br>> do not have a real buffer their behavior in this circumstances is incorrect.<br>> You should avoid<br>> instantiating the ImageFileWriter or the ImageSeriesWriter over an image<br>> adaptor type.<br>> From an email to the user list by Luis'<br>> (<a href="http://www.itk.org/pipermail/insight-users/2005-April/012553.html" target="_blank">http://www.itk.org/pipermail/insight-users/2005-April/012553.html</a>):<br>> This means that when you use ImageAdaptors, you must make sure<br>> that the filter receiving the Adaptor is based on the use of the<br>> "*WithIndex" iterators.<br>><br>> On Mon, Feb 21, 2011 at 1:36 PM, Hsieh <<a href="mailto:M.Hsieh@student.tudelft.nl">M.Hsieh@student.tudelft.nl</a>> wrote:<br>>><br>>> Hi,<br>>><br>>><br>>><br>>> Now I send it to Insight-Users mailing list.<br>>><br>>> My purpose is to extract elements from the tensor image to analyze and<br>>> register the tensor channels. With your help now I can do so with vector<br>>> image adaptor, which extracts one of the element of the vector. However, in<br>>> the example of ImageAdaptor3.cxx, the adaptor itself cannot directly be fed<br>>> into the writer to create a scalar image. It is shown that a filter, such as<br>>> rescaling the intensity, has to be done and therefore the<br>>> rescaler->GetOutput() can be set as the input image for writer. Is there a<br>>> way not to modify the intensity of the image? Is there an identity filter or<br>>> something like that?<br>>><br>>><br>>><br>>> Best regards,<br>>><br>>> Michael<br>>><br>>><br>>><br>>><br>>><br>>><br>>><br>>> This is more of a question for the Insight-Users mailing list.<br>>><br>>><br>>><br>>> That being said, you don't show your work, so I can't say exactly what<br>>> you're doing wrong.<br>>><br>>><br>>><br>>> I wrote the NIfTI image reader, and as I remember there's some strange<br>>> things that go on with respect to Images with dimension > 3.<br>>><br>>><br>>><br>>> If I recall correctly, in a NIfTI image dimensions of [ 128 128 64 1 6 ]<br>>> would not correspond to an 5D scalar image at all. It would be a 3D image<br>>> where each voxel is a 6-element vector. The 4th dimension is ALWAYS<br>>> interpreted as a time dimension, and the sixth and subsequent dimensions are<br>>> interpreted according to what the image modality actually was. Most often,<br>>> and what's implemented in the reader, is to interpret it as an Image of<br>>> Vector voxels. So NiftiImageIO reads in 6 3D volumes, and then constructs<br>>> vector pixels by pulling one pixel from each of the volumes.<br>>><br>>><br>>><br>>> In other words if you used<br>>><br>>><br>>><br>>> typedef itk::Image< itk::Vector<float, 6>, 3 > ImageType;<br>>><br>>> typedef itk::ImageFileReader<Imagetype> ImageReaderType;<br>>><br>>><br>>><br>>> You would get all the data. If you use<br>>><br>>><br>>><br>>> typedef itk::Image<float, 3> ImageType;<br>>><br>>> typedef itk::ImageFileReader<ImageType> ImageReaderType;<br>>><br>>><br>>><br>>> the ImageFileReader will think that it's a vector image and try to convert<br>>> the vector voxels to a scalar voxel, probably by taking the first value of<br>>> each voxel's vector. It will then report the image size as you reported.<br>>><br>>><br>>><br>>> From: Hsieh <<a href="mailto:M.Hsieh@student.tudelft.nl">M.Hsieh@student.tudelft.nl</a>><br>>> Date: Fri, 18 Feb 2011 16:35:07 +0100<br>>> To: ITK <<a href="mailto:insight-developers@itk.org">insight-developers@itk.org</a>><br>>> Subject: [Insight-developers] Problem in reading 5D nifti image<br>>><br>>><br>>><br>>> Hi,<br>>><br>>><br>>><br>>> I am trying to read a diffusion tensor image in nifti(.nii) format, which<br>>> has dimension of [128 128 64 1 6]. However, the image I got after read by<br>>> the itkImageFileReader.h had dimension only [128 128 64 1 1]. The last two<br>>> dimension are suppressed by the reader. When I looked into the class (.h)<br>>> and the .txx file, I found out that the numberOfDimensionsIO, which is 3, is<br>>> smaller than TOutputImage::ImageDimension, which is set manually to 5, so<br>>> that the 4th and the 5th dimension are set to 1 later. Why does that happen?<br>>> numberOfDimensionsIO should be 5 in this case.<br>>><br>>><br>>><br>>> Best regards,<br>>><br>>> Meng-Kang Hsieh (Michael)<br>>><br>>> OpSciTech, Erasmus Mundus<br>>><br>>> Delft University of Technology<br>>><br>>><br>>><br>>><br>>><br>>> Best regards,<br>>><br>>> Meng-Kang Hsieh (Michael)<br>>><br>>> OpSciTech, Erasmus Mundus<br>>><br>>> Delft University of Technology<br>>><br>>><br>>><br>>><br>>><br>>> _____________________________________<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.html" target="_blank">http://www.kitware.com/products/protraining.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>><br>> _____________________________________<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.html" target="_blank">http://www.kitware.com/products/protraining.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>_____________________________________<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.html" target="_blank">http://www.kitware.com/products/protraining.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><o:p></o:p></span></p></div></div></blockquote></div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p></div></body></html>