<div dir="ltr"><div><div><div><div><div><div><div><div>Hi all,<br><br></div>I've implemented a basic image reader to read a volume from a data set in a HDF5 file. I subclassed vtkImageAlgorithm and reimplemented RequestInformation and RequestData.<br><br></div>I realize now that to be a good "VTK citizen", I should probably have subclassed vtkImageReader2 instead.<br><br></div>But looking at the vtkImageReader2.h header, much of the additional API / protected member variables it imposes don't make sense for my use case. E.g:<br><br>  virtual void SetFileNames(vtkStringArray *);<br>  vtkGetObjectMacro(FileNames, vtkStringArray);<br><br></div>My reader will not support multiple files.<br><br>  virtual void SetFilePrefix(const char *);<br>  vtkGetStringMacro(FilePrefix);<br><br>  virtual void SetFilePattern(const char *);<br>  vtkGetStringMacro(FilePattern);<br></div><br>I have no pressing need for this.<br><br>  virtual void SetMemoryBuffer(void *);<br>  virtual void *GetMemoryBuffer() { return this->MemoryBuffer; }<br><br>  virtual void SetMemoryBufferLength(vtkIdType buflen);<br>  vtkIdType GetMemoryBufferLength() { return this->MemoryBufferLength; }<br></div><br>I'll support loading from files on disk only.<br><br>  virtual void SetDataScalarType(int type);<br>  ...<br>  vtkGetMacro(DataScalarType, int);<br><br></div>In my reader, the scalar datatype is always deduced from looking at the file. It doesn't make sense to let the user set it. (I guess this API is meant more for "raw" format readers?). I could implement the getter.<br><br>  vtkSetMacro(NumberOfScalarComponents,int);<br>  vtkGetMacro(NumberOfScalarComponents,int);<br><br></div><div>This I could obviously implement.<br><br>  vtkSetVector6Macro(DataExtent,int);<br>  vtkGetVector6Macro(DataExtent,int);<br><br></div><div>Again, the setter doesn't make sense for my format, but I could of course implement the getter.<br><br></div><div>The same is true for other setters/getters like spacing, origin, byte order et.c.<br><br></div><div>But before I go on, let me get to my questions:<br><br></div><div>* What will I "lose" by basing my reader on vtkImageAlgorithm instead of vtkImageReader2. Will my reader be unusable with some parts of VTK? Which?<br><br></div><div>* Is it frowned upon to make an image reader that derives directly from vtkImageAlgorithm instead of vtkImageReader2 or vtkImageReader?<br><br></div><div>Thanks,<br></div><div>Elvis<br></div></div>