[vtkusers] Re ad *.ics image header (Python)

Jérôme jerome.velut at gmail.com
Wed Dec 2 15:02:47 EST 2009


Hi Alexander,

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.

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...)

FYI, take a look at http://libics.sourceforge.net/ . this is not VTK nor my
implementation, but it gives a good description of the format.

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.

Best regards,
Jerome

2009/12/2 Alexander Richter <Alexander.Richter at student.fh-kiel.de>

>
> Hi Jerome,
>
> sorry for answering that late. I wrote my own class which inherits from
> vtkImageReader2. First I am parsing the *.ics-file with all its parameters.
> In the parsing method itself I define some things, like:
>
>   self.SetFileName(values[1]+".ids")
>   self.SetFileDimensionality(3)
>   self.SetDataExtent(...)
>   self.SetDataScalarTypeToUnsignedInt()
>   self.SetDataByteOrderToLittleEndian()
>
> After defining I am trying to update the whole thing with reader.Update()
> but there are some errors I don't understand. The vtkOutputWindow says:
>
>   Warning: In ..\..\Source VTK\IO\vtkImageReader2.cxx, line 711
>   vtkImageReader2 (010BE448): File operation failed.
>
>   Generic Warning: In ..\..\Source VTK\IO\vtkImageReader2.cxx, line 781
>   File operation failed. row = 0, Read = 2048, FilePos = -1
>
> It looks like there are some problems in the beginning of reading but I
> can't interprete the meaning of it because of it's short description.
>
> When I print out the reader object afterwards, it says:
>
>  vtkImageReader2 (010BE448)
>   Debug: Off
>   Modified Time: 4889
>   Reference Count: 2
>   Registered Events: (none)
>   Executive: 010BEF10
>   ErrorCode: No error
>   Information: 010BE590
>   AbortExecute: Off
>   Progress: 1
>   Progress Text: (None)
>   FileName: liver-orig001.ids
>   FileNames: 00000000
>   FilePrefix: (none)
>   FilePattern: %s.%d
>   FileNameSliceOffset: 0
>   FileNameSliceSpacing: 1
>   DataScalarType: int
>   NumberOfScalarComponents: 1
>   File Dimensionality: 3
>   File Lower Left: Off
>   Swap Bytes: Off
>   DataIncrements: (4, 2048)
>   DataExtent: (0, 511, 0, 511, 0, 182)
>   DataSpacing: (1, 1, 1)
>   DataOrigin: (0, 0, 0)
>   HeaderSize: 0
>   Internal File Name: liver-orig001.ids
>
>
> Does anyone know how to solve the problem ?
> By the way - thanks for offering the *.cxx-classes. How difficult is it the
> embedd into the program ?
>
> Best regards,
> Alex
>
>
> Jérôme-2 wrote:
> >
> > Hi,
> >
> > The ics header gives you the information for a basic RAW reader:
> > - Extent,
> > - Spacing
> > - Orientation
> > - ...
> >
> > In Python you can parse the ics header, set a vtkImageReader with the
> > parameters and set the filename to blabla.ids
> >
> > I can send cxx classes that you should be able to wrap in python. These
> > classes implement a vtkICSImageReader
> >
> > Best regards,
> > Jerome
> >
>
> --
> View this message in context:
> http://old.nabble.com/Read-*.ics-image-header-%28Python%29-tp26196866p26609269.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091202/bd3a2d7f/attachment.htm>


More information about the vtkusers mailing list