[Paraview] vtkJPEGReader as Plugin - Loading Volumes
Christian Werner
christian.werner at rwth-aachen.de
Mon Feb 8 18:38:57 EST 2010
Hello,
thanks for the quick response!
The one thing I am missing is where in your sprintf example
"this->FilePrefix" and "this->SliceNumber" comes from. In Paraview I get
an OpenFile Dialog which probably comes up because the plugin is defined
as a source. Maybe it is because there is an <FileListDomain> markup,
though.
When I then choose a file (actually I can select "image-..", for the
whole series) this is internally passed as the parameter to the
"SetFilePattern" Command in the JPEGReader Plugin (ist that so?). This
seems to be what I set up in the appropriate .xml file.
I do have to make sure that when this function is called the actual
FilePattern is passed that contains the image prefix. But editing the
.xml file I have no clue how to reference the filename which is of
course variable. (This would be the "this->FilePrefix" in your example)
and mix it up with these %s and %d (where I don't know how Paraview
fills them). Put together, I am somewhat lost.
Best regars,
Christian
Utkarsh Ayachit wrote:
> If you look at the documentation for the class and the corresponding
> methods : SetFilePrefix and SetFilePattern, you'll see that it
> mentions what the pattern is supposed to be.
> http://www.vtk.org/doc/nightly/html/classvtkImageReader2.html#a22d3f734323da8d5baaf798bbd7b4bc5
>
>
> This FilePattern is indeed a sprintf syntax, I am not sure how come
> you don't see the commonality.
>
> sprintf(foo, "%s/image%d.jpeg", this->FilePrefix, this->SliceNumber)
>
> will give you "<somepath>/image<some number>.jpeg" which is what the
> reader tries.
>
> There's nothing magical in the XML here. It's the reader that's
> dictating how it decides to read the files or determine filenames etc.
> You might want to look at the implementation of vtkImageReader2 to
> understand more.
>
>
> Utkarsh
>
>
> On Mon, Feb 8, 2010 at 3:19 PM, Christian Werner
> <christian.werner at rwth-aachen.de> wrote:
>
>> I am trying hard, but I just don't get the point. I'd love to read me
>> into
>> this .xml editing, but there's no source for that, except of the book
>> which
>> seems to be an overkill for my needs.
>>
>> I feel that in "%s/image%d.jpg" some pointer to the real filename is
>> missing
>> (it does not work as such). %s seems to be the directory, %the slice
>> number,
>> so is there a variable like %f for the filename? I know the fprint
>> syntax
>> but I just can't see any commonality here.
>>
>> If it happens that the book is the only source for a good
>> introduction to
>> this topic than somebody please tell me. I really do not intend to annoy
>> anyone, but I am having problems finding good documenation here, so I
>> chose
>> this Mailing List as a guide.
>>
>> Best regards,
>> Christian
>>
>>
>> Utkarsh Ayachit wrote:
>>
>>> The problem seems to be that you are using the Pattern incorrectly. It
>>> should be of the form: "%s/image%d.jpg" where %s gets replaced by the
>>> directory while %d gets replaced by the slice number.
>>>
>>> Utkarsh
>>>
>>> On Sat, Feb 6, 2010 at 4:52 PM, Christian Werner
>>> <christian.werner at rwth-aachen.de> wrote:
>>>
>>>
>>>> Hi there!
>>>>
>>>> I'm having trouble getting the vtkJPEGReader to work properly as
>>>> plugin.
>>>> Specifically I don't know how to set up the approriate .xml file. It
>>>> works
>>>> with command="SetFileName" perfectly, but that way I am getting the
>>>> first
>>>> slice only. I see that one should use SetFilePrefix and/or
>>>> SetFilePattern,
>>>> but how can I make Paraview pass the appropriate parameters to the
>>>> plugin??
>>>>
>>>> This is how my .xml looks like, it's just a guess, I really don't know
>>>> better:
>>>>
>>>> <ServerManagerConfiguration>
>>>> <ProxyGroup name="sources">
>>>> <SourceProxy name="JPEGImageReader"
>>>> class="vtkJPEGReader"
>>>> label="JPEG reader">
>>>> <Documentation
>>>> short_help="Read a JPEG file."
>>>> long_help="Read a JPEG file into an image data.">
>>>> The JPEG image reader reads JPG files, and the output is a uniform
>>>> rectilinear (image/volume) dataset. The default file extension is
>>>> .jpg.
>>>> </Documentation>
>>>> #will become e.g. /home/christian/jpegs
>>>> <StringVectorProperty
>>>> name="Files"
>>>> animateable="0"
>>>> command="SetFilePrefix"
>>>> number_of_elements="1">
>>>> <FileListDomain name="files"/>
>>>> <Documentation>
>>>> This property specifies the File Prefix for the JPEG reader.
>>>> </Documentation>
>>>> <Hints>
>>>> <UseDirectoryName />
>>>> </Hints>
>>>> </StringVectorProperty>
>>>> #file pattern
>>>> <StringVectorProperty
>>>> name="Pattern"
>>>> animateable="0"
>>>> command="SetFilePattern"
>>>> number_of_elements="1"
>>>> default_value="/*.jpg">
>>>> </StringVectorProperty>
>>>> <!-- End JPEGImageReader -->
>>>> </SourceProxy>
>>>> </ProxyGroup>
>>>> </ServerManagerConfiguration>
>>>>
>>>> With that, I get
>>>>
>>>> Unable to open file /home/christian/jpges.0
>>>>
>>>>
>>>> when trying to open a set of jpges...
>>>>
>>>> Does anyone have any idea? I'd also like to know where there is
>>>> documentation on all these markups like what you can put in <Hint>,
>>>> etc..
>>>>
>>>>
>>>> Best regards,
>>>> Christian
>>>> _______________________________________________
>>>> 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 ParaView Wiki at:
>>>> http://paraview.org/Wiki/ParaView
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.paraview.org/mailman/listinfo/paraview
>>>>
>>>>
>>>>
>>
More information about the ParaView
mailing list