<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2016-07-05 9:32 GMT+02:00 Elvis Stansvik <span dir="ltr"><<a href="mailto:elvis.stansvik@orexplore.com" target="_blank">elvis.stansvik@orexplore.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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></div></div></blockquote><div><br></div><div>Sorry, here I meant just the getter. This is again a case where the setter doesn't make sense for me, since the number of scalar components is always 1 in my format (or possibly some other number in the future, but always derived from what's in the file automatically, not to be set by the user).<br><br></div><div>Elvis<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><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>
</blockquote></div><br></div></div>