/// Create a DICOM object by reading from a file.
///
/// This function assumes the standard file encoding structure: 128-byte
/// preamble, file meta group, and the rest of the data set.
Create a DICOM object by reading from a file.
This function assumes the standard file encoding structure: 128-byte
preamble, file meta group, and the rest of the data set.
Create a DICOM object by reading from a file . This function assumes the standard file encoding structure : 128 - byte preamble file meta group and the rest of the data set .
pub fn open_file_with_dict<P: AsRef<Path>>(path: P, dict: D) -> Result<Self> {
        let mut file = BufReader::new(File::open(path)?);
        // skip preamble
        {
            let mut buf = [0u8; 128];
            // skip the preamble
            file.read_exact(&mut buf)?;
        }
        // read metadata header
        let meta = FileMetaTable::from_reader(&mut file)?;
        // read rest of data according to metadata, feed it to object
        let ts = get_registry()
            .get(&meta.transfer_syntax)
            .ok_or(Error::UnsupportedTransferSyntax)?;
        let cs = SpecificCharacterSet::Default;
        let mut dataset = DataSetReader::new_with_dictionary(file, dict.clone(), ts, cs)?;
        Ok(RootDicomObject {
            meta,
            obj: InMemDicomObject::build_object(&mut dataset, dict, false, Length::UNDEFINED)?,
        })
    }
pub fn open_file_with_dict < P : AsRef < Path > > ( path : P , dict : D ) -> Result < Self > { let mut file = BufReader :: new ( File :: open ( path ) ? ) ; // skip preamble { let mut buf = [ 0u8 ; 128 ] ; // skip the preamble file . read_exact ( & mut buf ) ? ; } // read metadata header let meta = FileMetaTable :: from_reader ( & mut file ) ? ; // read rest of data according to metadata, feed it to object let ts = get_registry ( ) . get ( & meta . transfer_syntax ) . ok_or ( Error :: UnsupportedTransferSyntax ) ? ; let cs = SpecificCharacterSet :: Default ; let mut dataset = DataSetReader :: new_with_dictionary ( file , dict . clone ( ) , ts , cs ) ? ; Ok ( RootDicomObject { meta , obj : InMemDicomObject :: build_object ( & mut dataset , dict , false , Length :: UNDEFINED ) ? , } ) }
Create a DICOM object by reading from a file.
Create a DICOM object by reading from a file .
path
P
dict
D