<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000'><font size="2">Hi Manuel,</font><div><font size="2"><br></font></div><div><font size="2">Sorry for the slow answer, I hope you haven't lost interest! This is in fact pretty cool, adding support for HDF5 has been on the todo list for a while.</font></div><div><font size="2">In fact as you may have seen on the mailing list there have been discussions in the past regarding the use of netCDF to read in HDF5 files. Supposedly, if you compile the netCDF lib with HDF5 support it should work but it seems many netCDF libs are not built in that way. A proper HDF5 datasource is probably nicer :-)</font></div><div><font size="2"><br></font></div><div><font size="2">Anyway, regarding your question I suspect you haven't tried the right tool. If you use the datawizard it won't look for matrices. Have you tried the Create -> Matrix menu? Directly or from the Create -> Image and then clicking on the matrix with a small star? Once you've created a matrix, it should be possible to visualize with the View -> Matrices menu.</font></div><div><font size="2"><br></font></div><div><font size="2">If you have a working HDF5 datasource, it would be nice to provide it to the community! HDF5 has become so widespread these last years, that I'm sure there will be many interested people.</font></div><div><font size="2"><br></font></div><div><font size="2">Hoping to hear back from you soon,</font></div><div><font size="2"><br></font></div><div><font size="2">Nicolas</font><br><br><hr id="zwchr" style="font-size: 12pt;"><blockquote style="font-size: 12pt; border-left-width: 2px; border-left-style: solid; border-left-color: rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; color: rgb(0, 0, 0); font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica, Arial, sans-serif;"><b>De: </b>"Manuel Ilg" <manuel.ilg@aisec.fraunhofer.de><br><b>À: </b>kst@kde.org<br><b>Envoyé: </b>Vendredi 1 Septembre 2017 16:53:00<br><b>Objet: </b>Adding Hdf5 Plugin, cant see _matrixlist<br><br>Hi,<br><br>I am trying to add Hdf5 as Datasource to kst. It already works with <br>vectors. So if i open a hdf5 file it recursively searches the file for 1 <br>dimensional Datasets. I can select all these Datasets and plot them.<br><br>After this worked fine, i looked at the matlab.cpp and netcdfsource.cpp <br>files again and tried to copy their matrix interfaces but i cant get it <br>to work. i save all the matrices in the _matrixList but appearently kst <br>never uses the list() of my matrixdatainterface class. So i cant select <br>the datasets in the kst gui.<br><br>this is my matrix interface class:<br><br>/**********************<br>Matrix Interface<br>***********************/<br>class DataInterfaceHdf5Matrix : public DataSource::DataInterface<DataMatrix><br>{<br>public:<br><br>   DataInterfaceHdf5Matrix(Hdf5Source& s) : Hdf5(s) {qDebug()<< "matrix";}<br><br>   // read one element<br>   int read(const QString&, DataMatrix::ReadInfo&);<br><br>   // named elements<br>   QStringList list() const { qDebug() << "list() mat" << endl; return <br>Hdf5._matrixList; }<br>   bool isListComplete() const { return true; }<br>   bool isValid(const QString&) const;<br><br>   // T specific<br>   const DataMatrix::DataInfo dataInfo    (const QString&) const;<br>   void setDataInfo(const QString&, const DataMatrix::DataInfo&) {}<br><br>   // meta data<br>   QMap<QString, double> metaScalars(const QString&) { return <br>QMap<QString, double>(); }<br>   QMap<QString, QString> metaStrings(const QString&) { return <br>QMap<QString, QString>(); }<br><br><br>private:<br>   Hdf5Source& Hdf5;<br>};<br><br><br>const DataMatrix::DataInfo DataInterfaceHdf5Matrix::dataInfo(const <br>QString& matrix) const<br>{<br>   qDebug() << "im info" << endl;<br>   if (!Hdf5._matrixList.contains( matrix ) ) {<br>     return DataMatrix::DataInfo();<br>   }<br><br>   QByteArray bytes = matrix.toLatin1();<br>   hid_t dataset = H5Dopen(Hdf5._Hdf5file, bytes.data(), H5P_DEFAULT);<br>   hid_t dspace = H5Dget_space(dataset);<br>   const int ndims = H5Sget_simple_extent_ndims(dspace);<br>   hsize_t dims[ndims];<br>   H5Sget_simple_extent_dims(dspace, dims, NULL);<br>   H5Dclose(dataset);<br>   H5Sclose(dspace);<br>   if (!ndims) {<br>     return DataMatrix::DataInfo();<br>   }<br><br>   if (ndims != 2) {<br>     return DataMatrix::DataInfo();<br>   }<br><br>   DataMatrix::DataInfo info;<br>   info.samplesPerFrame = 1;<br>   info.xSize = dims[0];<br>   info.ySize = dims[1];<br><br>   return info;<br>}<br><br>int DataInterfaceHdf5Matrix::read(const QString& field, <br>DataMatrix::ReadInfo& p)<br>{qDebug() << "im read" << endl;<br>   int count = Hdf5.readMatrix(p.data->z, field);<br><br>   p.data->xMin = 0;<br>   p.data->yMin = 0;<br>   p.data->xStepSize = 1;<br>   p.data->yStepSize = 1;<br><br>   return count;<br>}<br><br><br>bool DataInterfaceHdf5Matrix::isValid(const QString& field) const {<br>     qDebug() << "im valid" << endl;<br>   return Hdf5._matrixList.contains( field );<br>}<br><br>the only method beeing used is:<br>DataInterfaceHdf5Matrix(Hdf5Source& s) : Hdf5(s) {qDebug()<< "matrix";}<br>all others were never used. I hope you can give me a hint, what im doing <br>wrong. Like i said i can see and plot all 1 dimensional Datasets, they <br>are stored in _fieldList and use the DataVector DataInterface. But i <br>cant see or plot the 2 dimensional Data in the DataMatrix DataInterface. <br>i cant even display the names that are stored in the _matrixList in kst.<br><br>here is my header file:<br><br>#ifndef Hdf5_H<br>#define Hdf5_H<br><br>#include <datasource.h><br>#include <dataplugin.h><br>#include "H5Cpp.h"<br><br>class DataInterfaceHdf5Vector;<br>class DataInterfaceHdf5Matrix;<br><br><br>class Hdf5Source : public Kst::DataSource {<br>   Q_OBJECT<br><br>   public:<br>     Hdf5Source(Kst::ObjectStore *store, QSettings *cfg, const QString& <br>filename, const QString& type, const QDomElement& e);<br><br>     ~Hdf5Source();<br><br>     bool init();<br>     virtual void reset();<br><br>     Kst::Object::UpdateType internalDataSourceUpdate();<br><br>     int readField(double *v, const QString& field, int s, int n);<br><br>     int readMatrix(double *v, const QString& field);<br><br>     static herr_t file_info(hid_t o_id, const char *name, const <br>H5O_info_t *object_info, void *op_data);<br><br>     int samplesPerFrame(const QString& field);<br>     int frameCount(const QString& field = QString()) const;<br><br>     QString fileType() const;<br><br>     void save(QXmlStreamWriter &streamWriter);<br><br><br>   private:<br>     QMap<QString, int> _frameCounts;<br>     int _maxFrameCount;<br><br>     hid_t _Hdf5file;<br>     QStringList _fieldList;<br>     QStringList _matrixList;<br><br>     friend class DataInterfaceHdf5Vector;<br>     friend class DataInterfaceHdf5Matrix;<br><br>     DataInterfaceHdf5Vector* iv;<br>     DataInterfaceHdf5Matrix* im;<br>};<br><br>if u need more Details just ask.<br><br>Have a nice Weekend :)<br><br></blockquote><br></div></div></body></html>