Skip to main content

DatasetDescription

Struct DatasetDescription 

Source
pub struct DatasetDescription {
Show 14 fields pub name: String, pub bids_version: String, pub license: Option<String>, pub authors: Option<Vec<String>>, pub acknowledgements: Option<String>, pub how_to_acknowledge: Option<String>, pub funding: Option<Vec<String>>, pub ethics_approvals: Option<Vec<String>>, pub references_and_links: Option<Vec<String>>, pub dataset_doi: Option<String>, pub dataset_type: Option<String>, pub generated_by: Option<Vec<GeneratedBy>>, pub source_datasets: Option<Vec<Value>>, pub pipeline_description: Option<PipelineDescription>,
}
Expand description

Contents of a BIDS dataset_description.json file.

See: https://bids-specification.readthedocs.io/en/stable/modality-agnostic-files.html

§Example

use bids_core::DatasetDescription;

let json = r#"{"Name": "My Dataset", "BIDSVersion": "1.9.0"}"#;
let desc: DatasetDescription = serde_json::from_str(json).unwrap();
assert_eq!(desc.name, "My Dataset");
assert!(!desc.is_derivative());

Fields§

§name: String

Name of the dataset.

§bids_version: String

The version of the BIDS standard used.

§license: Option<String>

What license the dataset is distributed under.

§authors: Option<Vec<String>>

List of individuals who contributed to the creation/curation of the dataset.

§acknowledgements: Option<String>

Text acknowledging contributions of individuals or institutions.

§how_to_acknowledge: Option<String>

How to acknowledge this dataset when used in publications.

§funding: Option<Vec<String>>

List of sources of funding.

§ethics_approvals: Option<Vec<String>>

List of ethics committee approvals.

§references_and_links: Option<Vec<String>>

List of references to publications about the dataset.

§dataset_doi: Option<String>

The DOI of the dataset.

§dataset_type: Option<String>

Type of dataset: “raw” or “derivative”.

§generated_by: Option<Vec<GeneratedBy>>

Information about the pipeline that generated a derivative dataset.

§source_datasets: Option<Vec<Value>>

Datasets that were used to generate this derivative dataset.

§pipeline_description: Option<PipelineDescription>

Legacy field (deprecated in BIDS 1.4.0).

Implementations§

Source§

impl DatasetDescription

Source

pub fn from_dir(dir: &Path) -> Result<Self>

Load dataset_description.json from the given directory.

§Errors

Returns BidsError::MissingDatasetDescription if the file doesn’t exist, or an I/O or JSON error if the file can’t be read or parsed.

Source

pub fn validate(&self) -> Result<()>

Validate that mandatory fields are present.

§Errors

Returns BidsError::MissingMandatoryField if Name or BIDSVersion is empty.

Source

pub fn is_derivative(&self) -> bool

Whether this is a derivative dataset.

Source

pub fn pipeline_name(&self) -> Option<&str>

Get the pipeline name for derivative datasets.

Source

pub fn save_to(&self, dir: &Path) -> Result<()>

Save this description to a dataset_description.json file.

§Errors

Returns an I/O error if the directory doesn’t exist or the file can’t be written, or a JSON error if serialization fails.

Trait Implementations§

Source§

impl Clone for DatasetDescription

Source§

fn clone(&self) -> DatasetDescription

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DatasetDescription

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for DatasetDescription

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for DatasetDescription

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Serialize for DatasetDescription

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,