<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hello David,</div><div><br></div><div>What is and is not working?</div><div>Is there an error being reported?</div><div>Can you compute the time dimension independently?</div><div><br></div><div>I am not sure what you mean by a 4D image. SimpleITK support 2D and 3D image of scalars and vector components. Some may call a 3D image of multi-components 4D others may call an array of 3D images a 4D image. SimpleITK currently does not have plans to support images with 4 spacial dimension, however either of the prior approaches may work just fine.</div><div><br></div><div>Are you able to load the image with ReadImage as a sitkImage of Vectors?</div><div><br></div><div>If you are an you are getting an error with the Statistics, just loop over the number of components ( it hopefully worked out to be the time dimension ), and run the filer for each dimension.</div><div><br></div><div>Are you not able to Read?</div><div><br></div><div>It may be easiest to write the 4D as a series of 3D image and process the time dimension independently.</div><div>An outstanding feature of the sitk Reader is the ability to specify the region of interest. Generically, this feature would include being able to specify the region such that it can map a 4D image into a 3D or even a 2D image, in addition to stream like processing. If you need the feature create a jira ticket.</div><div><br></div><div><br></div><br><div><div>On Nov 28, 2012, at 2:32 PM, David M. Welch <<a href="mailto:david.m.welch@gmail.com">david.m.welch@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 14px; font-family: Calibri, sans-serif; "><div>Hi Brad, </div><span id="OLK_SRC_BODY_SECTION"><div style="font-size:14px; word-wrap:break-word"><div><div style="font-family: Calibri, sans-serif; "><br></div><div style="font-family: Calibri, sans-serif; ">I'm running into this issue today with an fMRI dataset (3D + time) that I've preprocessed with AFNI and I want to register it with a label image and get out vectors for each 3D set in the time series.
I'd like to have this type of behavior:</div><div style="font-family: Calibri, sans-serif; "><br></div><div style="font-family: Calibri, sans-serif; "><span class="Apple-style-span" style="color: rgb(94, 94, 95); font-family: 'Lucida Console'; ">>>> from SimpleITK import *</span></div><div style="font-family: Calibri, sans-serif; "><font class="Apple-style-span" face="Lucida Console" color="#5e5e5f">>>> label = ReadImage(label_file)</font></div><div style="font-family: Calibri, sans-serif; "><font class="Apple-style-span" face="Lucida Console" color="#5e5e5f">>>> image = ReadImage(fMRI_file)</font></div><div style="font-family: Calibri, sans-serif; "><font class="Apple-style-span" face="Lucida Console"><font class="Apple-style-span" color="#5e5e5f">>>> stats = LabelStatistics(label, image)</font><font class="Apple-style-span" color="#919191"># TODO: Docstring should specify that label comes first!</font></font></div></div></div></span></div></blockquote><div><br></div><div>Thanks for the note there. The LabelStatistics filter is a manually written one, only recently have we gotten to facilities to extract the doxygen documentation from these classes and place it into the Python docstrings. So if this documentation is updates in the code it will shortly show up in the docstring.</div><div><br></div><div>The above line is not quite right. The procedure LabelStatistics returns a MeasurementMap type object, while below appears to be manipulating a LabelStatisticsImageFilter... I think.</div><div><br></div><div>Consider using the following lines ( I know two lines to run a SimpleITK filter, such a burden :)</div><div><br></div><div>stats = LabelStatisticsImageFilter()</div><div>stats.Execute( label, image)</div><div><br></div><div><br></div><div><br></div><br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 14px; font-family: Calibri, sans-serif; "><span id="OLK_SRC_BODY_SECTION"><div style="font-size:14px; word-wrap:break-word"><div><div><font class="Apple-style-span" color="#5e5e5f" face="Lucida Console">>>> for labelCode in stats.GetValidLabels():</font></div><div><font class="Apple-style-span" color="#5e5e5f" face="Lucida Console">>>> print stats.GetSum(labelCode)</font></div><div><font class="Apple-style-span" color="#5e5e5f" face="Lucida Console">[10, 30, 20, 15, …]</font></div><div><font class="Apple-style-span" color="#5e5e5f" face="Lucida Console">[15, 25, 20, 10, …]</font></div><div><font class="Apple-style-span" color="#5e5e5f" face="Lucida Console">Etc.</font></div><div><font class="Apple-style-span" color="#919191" face="Lucida Console"><br></font></div><div style="font-family: Calibri, sans-serif; ">Is there a bug report/ticket for 4D support in SimpleITK? What needs to be changed to extend LabelStatistics to handle 4D images?</div><div style="font-family: Calibri, sans-serif; "><br></div><div style="font-family: Calibri, sans-serif; "><div><div class="PlainText" style="font-family: Tahoma; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; ">
Cheers, </div><div class="PlainText" style="font-family: Tahoma; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; ">
David Welch, M.S.<br><br></div><div class="PlainText" style="font-family: Tahoma; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; "><hr></div><div class="PlainText" style="font-family: Tahoma; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; ">
Applications Developer</div><div class="PlainText" style="font-family: Tahoma; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; ">
Department of Psychiatry<br>
University of Iowa<br>
(319)384-9413<br><a href="mailto:dmwelch@healthcare.uiowa.edu">dmwelch@healthcare.iowa.edu</a></div><div class="PlainText" style="font-family: Tahoma; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; "><a href="mailto:david-welch@uiowa.edu">david-welch@iowa.edu</a></div></div><div class="PlainText" style="font-family: Tahoma; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; "><br></div></div></div><div style="font-family: Calibri, sans-serif; "><br></div><span id="OLK_SRC_BODY_SECTION" style="font-family: Calibri, sans-serif; "><div style="font-family: Calibri; font-size: 11pt; text-align: left; border-width: 1pt medium medium; border-style: solid none none; padding: 3pt 0in 0in; border-top-color: rgb(181, 196, 223); "><span style="font-weight:bold">From: </span>Bradley Lowekamp <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>><br><span style="font-weight:bold">Date: </span>Mon, 23 Apr 2012 11:00:26 -0400<br><span style="font-weight:bold">To: </span>Mathieu Stumpf <<a href="mailto:mathieu.stumpf@etu.unistra.fr">mathieu.stumpf@etu.unistra.fr</a>><br><span style="font-weight:bold">Cc: </span>"<a href="mailto:insight-users@itk.org">insight-users@itk.org</a>" <<a href="mailto:insight-users@itk.org">insight-users@itk.org</a>><br><span style="font-weight:bold">Subject: </span>Re: [Insight-users] ITK to VTK for 4D images<br></div><div><br></div><div><div style="word-wrap:break-word">Hello,
<div><br></div><div>What is the current issue you are having with your SimpleITK implementation?</div><div><br></div><div>Currently, I am aware what we don't have support to convert VectorImage to numpy arrays. But that is near the top of my todo list this week. </div><div><br></div><div>Also, I am interested in your input data? What do you mean by 4D? 3D + time? 3D+ multichannel? What is your input file format and what is the meta data that is report? If there is an issue with SimpleITK reading it, I'd like to see a sample file to see
if support could easily be added.</div><div><br></div><div>Brad</div><div><br><div><div>On Apr 23, 2012, at 8:22 AM, Mathieu Stumpf wrote:</div><br>
...<br><blockquote type="cite"><font class="Apple-style-span"><br></font>Well, it provide a vtkImageData (I checked with a print), but using it<br>
instead of my previous solution using SimpleITK make my application<br>
crash, without any debugging information. The previous working solution<br>being :<br><br>
self.sitk_image = sitk.ReadImage(str(file_path) )<br>
self.numpy_img = sitk.GetArrayFromImage( self.sitk_image ) <br>
n2vtk = vtkImageImportFromArray() # Converter<br>
n2vtk.SetArray(self.numpy_img)<br>
n2vtk.Update()<br>
self.vtk_image = n2vtk.GetOutput()<br><br>
I welcome any suggestion<br>
kind regards,<br>
mathieu<br><br><br><br>
_____________________________________<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><a href="http://www.itk.org/Wiki/ITK_FAQ">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">http://www.itk.org/mailman/listinfo/insight-users</a><br></blockquote></div><br><div><div style="word-wrap:break-word; font-family:Helvetica; font-size:12px"><span class="Apple-style-span" style="border-collapse: separate; font-size: 12px; "><div style="margin: 0px; "><font face="Helvetica" size="3" style="font:normal normal normal 12px/normal Helvetica">========================================================</font></div><div style="margin: 0px; "><font face="Helvetica" size="3" style="font:normal normal normal 12px/normal Helvetica">Bradley Lowekamp<span class="Apple-converted-space"> </span><span class="Apple-converted-space"> </span></font></div><div style="margin: 0px; "><font face="Helvetica" size="3" style="font:normal normal normal 12px/normal Helvetica">Medical Science and Computing for</font></div><div style="margin: 0px; "><font face="Helvetica" size="3" style="font:normal normal normal 12px/normal Helvetica">Office of High Performance Computing and Communications</font></div><div style="margin: 0px; "><font face="Helvetica" size="3" style="font:normal normal normal 12px/normal Helvetica">National Library of Medicine<span class="Apple-converted-space"> </span></font></div><div style="margin: 0px; "><font face="Helvetica" size="3" style="font:normal normal normal 12px/normal Helvetica"><a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a></font></div><br class="Apple-interchange-newline"></span></div><br class="Apple-interchange-newline"></div><br></div></div></div></span><br><br><hr>
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged. If you are not the intended recipient, you are hereby notified that any
retention, dissemination, distribution, or copying of this communication is strictly prohibited. Please reply to the sender that you have received the message in error, then delete it. Thank you.
<hr></div></span></div>
_____________________________________<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>http://www.kitware.com/products/protraining.php<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></body></html>