Hello, everyone!<br>I am writing my custom reader for my data format.I wrote it and Built it with some errors!<br>So I have some questions to ask for help!<br>Basic information:<br>My output data type is vtkImageData, so my code was deriven form vtkImageAlgorithm<br>
1.Should I use <b>FillInputPortInformation </b>or <b>FillOutputPortInformation </b>like below<br><br>int vtkMyPluginReader::FillOutputPortInformation(int, vtkInformation *info)<br>{<br> info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkImageData");<br>
return 1;<br>}<br clear="all"><br><b>or</b><br><br>int vtkMyPluginReader::FillInputPortInformation(int, vtkInformation *info)<br>{<br> info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkImageAlgorithm");<br>
return 1;<br>}<br><b>Which one is right when I am writing a reader NOT a filter?</b><br><br>2.My header is like that below. Is that enough for a reader?:<br>//----------------------------------------------------------------------------<br>
#ifndef __vtkMyPluginReader_h_<br>#define __vtkMyPluginReader_h_<br><br>#include "vtkImageAlgorithm.h"<br>#include "vtkMyPlugin.h" //Needed for read actual META_DATA<br><br>class VTK_EXPORT vtkMyPluginReader : public vtkImageAlgorithm<br>
{<br>public:<br> static vtkMyPluginReader *New();<br> vtkTypeRevisionMacro(vtkMyPluginReader, vtkImageAlgorithm);<br> void PrintSelf(ostream& os, vtkIndent indent);<br><br> vtkSetStringMacro( FileName );<br>
vtkGetStringMacro( FileName );<br><br> virtual int ReadMetaData(vtkInformation *outInfo);//Get the actual data from a data file<br><br>protected:<br> vtkMyPluginReader();<br> ~vtkMyPluginReader();<br><br> virtual int RequestData(vtkInformation *, vtkInformationVector **,<br>
vtkInformationVector *);<br><br> virtual int RequestInformation(vtkInformation *, vtkInformationVector **,<br> vtkInformationVector *);<br><br> virtual int FillOutputPortInformation(int, vtkInformation *);<br>
<br>public:<br> vtkMyplugin pluginfile;<br> char *FileName;<br><br>private:<br> vtkMyPluginReader(const vtkMyPluginReader&); //Not implemented<br> void operator=(const vtkMyPluginReader&); //Not implemented<br>
};<br>#endif<br>//----------------------------------------------------------------------------<br><br><br>Thank you so much for helping me!<br><br>-Seven<br>-- <br><a href="mailto:shenyanwen@gmail.com">shenyanwen@gmail.com</a><br>
Mobile Phone:13476177952<br>Tel: 027-87558144<br>