[ismrmrd] 225/281: adding close() method to IsmrmrdDataset for Python bindings
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Wed Jan 14 20:01:18 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to annotated tag ismrmrd0.5
in repository ismrmrd.
commit 688fb6a72062b566db7f1568d1cbec2b719e3f40
Author: Joseph Naegele <joseph.naegele at gmail.com>
Date: Thu Apr 24 10:34:00 2014 -0400
adding close() method to IsmrmrdDataset for Python bindings
---
ismrmrd_hdf5.cpp | 14 ++++++++++++++
ismrmrd_hdf5.h | 9 +++++++++
2 files changed, 23 insertions(+)
diff --git a/ismrmrd_hdf5.cpp b/ismrmrd_hdf5.cpp
index fc40770..1b6c362 100644
--- a/ismrmrd_hdf5.cpp
+++ b/ismrmrd_hdf5.cpp
@@ -50,6 +50,20 @@ int IsmrmrdDataset::openHDF5File()
return 0;
}
+void IsmrmrdDataset::close(void)
+{
+ if (file_open_) {
+ dataset_->flush(H5F_SCOPE_LOCAL);
+ dataset_->close();
+ dataset_.reset();
+ file_->flush(H5F_SCOPE_LOCAL);
+ file_->close();
+ file_.reset();
+ file_open_ = false;
+ }
+}
+
+
bool IsmrmrdDataset::linkExists(const char* name)
{
diff --git a/ismrmrd_hdf5.h b/ismrmrd_hdf5.h
index 538eaba..eba98bf 100644
--- a/ismrmrd_hdf5.h
+++ b/ismrmrd_hdf5.h
@@ -87,6 +87,15 @@ public:
data_path_ = groupname_ + std::string("/data");
}
+ /**
+ * Closes all references to the underlying HDF5 file.
+ *
+ * This method does not NEED to be called. It is most useful in
+ * a Python interpreter when a dataset instance has not been
+ * garbage collected but another process needs to read the HDF5 file.
+ */
+ void close(void);
+
/**
* Appends and NMR/MRI acquisition to the data set.
*
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/ismrmrd.git
More information about the debian-science-commits
mailing list