Hi Alexander,<br><br>To be honest, I am not competent regarding inheritance in python. In C++, you have different things to do in your VTK-child class for a correct pipelining (allocation, class name/type,...). BTW, I am not sure how suitable is a inheritance of vtkImageReader2 in your case, but you certainly have the reasons.<br>
<br>I do not have the cxx available now, but I wil tomorrow. You will have to compile it and then to wrap your lib to python. CMake will help you so much with something like VTK_WRAP_PYTHON (note that what I say could be very old-fashioned or obsolete since the last time I wrapped something to python was 3 years ago...)<br>
<br>FYI, take a look at <a href="http://libics.sourceforge.net/">http://libics.sourceforge.net/</a> . this is not VTK nor my implementation, but it gives a good description of the format.<br><br>Now, concerning your error, I cannot help! Sorry... Would you like to share your data, so that I can try with my humble reader? If it works, then I may be able to help you a bit more with a minimal-not-working code.<br>
<br>Best regards,<br>Jerome<br><br><div class="gmail_quote">2009/12/2 Alexander Richter <span dir="ltr">&lt;<a href="mailto:Alexander.Richter@student.fh-kiel.de">Alexander.Richter@student.fh-kiel.de</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Hi Jerome,<br>
<br>
sorry for answering that late. I wrote my own class which inherits from<br>
vtkImageReader2. First I am parsing the *.ics-file with all its parameters.<br>
In the parsing method itself I define some things, like:<br>
<br>
   self.SetFileName(values[1]+&quot;.ids&quot;)<br>
   self.SetFileDimensionality(3)<br>
   self.SetDataExtent(...)<br>
   self.SetDataScalarTypeToUnsignedInt()<br>
   self.SetDataByteOrderToLittleEndian()<br>
<br>
After defining I am trying to update the whole thing with reader.Update()<br>
but there are some errors I don&#39;t understand. The vtkOutputWindow says:<br>
<br>
   Warning: In ..\..\Source VTK\IO\vtkImageReader2.cxx, line 711<br>
   vtkImageReader2 (010BE448): File operation failed.<br>
<br>
   Generic Warning: In ..\..\Source VTK\IO\vtkImageReader2.cxx, line 781<br>
   File operation failed. row = 0, Read = 2048, FilePos = -1<br>
<br>
It looks like there are some problems in the beginning of reading but I<br>
can&#39;t interprete the meaning of it because of it&#39;s short description.<br>
<br>
When I print out the reader object afterwards, it says:<br>
<br>
  vtkImageReader2 (010BE448)<br>
   Debug: Off<br>
   Modified Time: 4889<br>
   Reference Count: 2<br>
   Registered Events: (none)<br>
   Executive: 010BEF10<br>
   ErrorCode: No error<br>
   Information: 010BE590<br>
   AbortExecute: Off<br>
   Progress: 1<br>
   Progress Text: (None)<br>
   FileName: liver-orig001.ids<br>
   FileNames: 00000000<br>
   FilePrefix: (none)<br>
   FilePattern: %s.%d<br>
   FileNameSliceOffset: 0<br>
   FileNameSliceSpacing: 1<br>
   DataScalarType: int<br>
   NumberOfScalarComponents: 1<br>
   File Dimensionality: 3<br>
   File Lower Left: Off<br>
   Swap Bytes: Off<br>
   DataIncrements: (4, 2048)<br>
   DataExtent: (0, 511, 0, 511, 0, 182)<br>
   DataSpacing: (1, 1, 1)<br>
   DataOrigin: (0, 0, 0)<br>
   HeaderSize: 0<br>
   Internal File Name: liver-orig001.ids<br>
<br>
<br>
Does anyone know how to solve the problem ?<br>
By the way - thanks for offering the *.cxx-classes. How difficult is it the<br>
embedd into the program ?<br>
<br>
Best regards,<br>
Alex<br>
<br>
<br>
Jérôme-2 wrote:<br>
&gt;<br>
&gt; Hi,<br>
&gt;<br>
&gt; The ics header gives you the information for a basic RAW reader:<br>
&gt; - Extent,<br>
&gt; - Spacing<br>
&gt; - Orientation<br>
&gt; - ...<br>
&gt;<br>
&gt; In Python you can parse the ics header, set a vtkImageReader with the<br>
&gt; parameters and set the filename to blabla.ids<br>
&gt;<br>
&gt; I can send cxx classes that you should be able to wrap in python. These<br>
&gt; classes implement a vtkICSImageReader<br>
&gt;<br>
&gt; Best regards,<br>
&gt; Jerome<br>
&gt;<br>
<br>
--<br>
View this message in context: <a href="http://old.nabble.com/Read-*.ics-image-header-%28Python%29-tp26196866p26609269.html" target="_blank">http://old.nabble.com/Read-*.ics-image-header-%28Python%29-tp26196866p26609269.html</a><br>

Sent from the VTK - Users mailing list archive at Nabble.com.<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 <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br>