[Paraview] Questions about writing a reader plugin

shenyanwen shenyanwen at gmail.com
Wed Apr 1 07:54:15 EDT 2009


Hello, everyone!
I am writing my custom reader for my data format.I wrote it and Built it
with some errors!
So I have some questions to ask for help!
Basic information:
My output data type is vtkImageData, so my code was deriven form
vtkImageAlgorithm
1.Should I use *FillInputPortInformation *or *FillOutputPortInformation *like
below

int vtkMyPluginReader::FillOutputPortInformation(int, vtkInformation *info)
{
    info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkImageData");
    return 1;
}

*or*

int vtkMyPluginReader::FillInputPortInformation(int, vtkInformation *info)
{
  info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkImageAlgorithm");
  return 1;
}
*Which one is right when I am writing a reader NOT a filter?*

2.My header is like that below. Is that enough for a reader?:
//----------------------------------------------------------------------------
#ifndef __vtkMyPluginReader_h_
#define __vtkMyPluginReader_h_

#include "vtkImageAlgorithm.h"
#include "vtkMyPlugin.h"               //Needed for read actual META_DATA

class VTK_EXPORT vtkMyPluginReader : public vtkImageAlgorithm
{
public:
    static vtkMyPluginReader *New();
    vtkTypeRevisionMacro(vtkMyPluginReader, vtkImageAlgorithm);
    void PrintSelf(ostream& os, vtkIndent indent);

    vtkSetStringMacro( FileName );
    vtkGetStringMacro( FileName );

    virtual int ReadMetaData(vtkInformation *outInfo);//Get the actual data
from a data file

protected:
    vtkMyPluginReader();
    ~vtkMyPluginReader();

    virtual int RequestData(vtkInformation *, vtkInformationVector **,
                            vtkInformationVector *);

    virtual int RequestInformation(vtkInformation *, vtkInformationVector
**,
                                   vtkInformationVector *);

    virtual int FillOutputPortInformation(int, vtkInformation *);

public:
    vtkMyplugin pluginfile;
    char *FileName;

private:
    vtkMyPluginReader(const vtkMyPluginReader&);      //Not implemented
    void operator=(const vtkMyPluginReader&);   //Not implemented
};
#endif
//----------------------------------------------------------------------------


Thank you so much for helping me!

-Seven
-- 
shenyanwen at gmail.com
Mobile Phone:13476177952
Tel: 027-87558144
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20090401/98371505/attachment.htm>


More information about the ParaView mailing list