NEP 4.3.0
NetCDF Expansion Pack
Loading...
Searching...
No Matches
dicomfile.c File Reference

DICOM User-Defined Format (UDF) dispatch layer. More...

#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "nep_nc4.h"
#include "dicominternal.h"

Functions

int nc4_var_list_add (NC_GRP_INFO_T *grp, const char *name, int ndims, NC_VAR_INFO_T **var)
int NC_DICOM_open (const char *path, int mode, int basepe, size_t *chunksizehintp, void *parameters, const NC_Dispatch *dispatch, int ncid)
int NC_DICOM_close (int ncid, void *ignore)
int NC_DICOM_abort (int ncid)
int NC_DICOM_inq_format (int ncid, int *formatp)
int NC_DICOM_inq_format_extended (int ncid, int *formatp, int *modep)
int NC_DICOM_get_vara (int ncid, int varid, const size_t *start, const size_t *count, void *value, nc_type memtype)

Detailed Description

DICOM User-Defined Format (UDF) dispatch layer.

Implements the NEP DICOM reader, which maps DICOM image SOP Instances to the netCDF-4 data model via libdicom. This implementation supports native (uncompressed), encapsulated JPEG Baseline, and encapsulated JPEG Lossless (Process 14) images, including multi-frame objects. JPEG Lossless decoding uses GDCM's bundled IJG libjpeg 6b codec (see dicomjpeglossless.h) since mainline libjpeg/libjpeg-turbo does not support it. Other transfer syntaxes may be rejected.

  • Primary image: exposed as a pixel_data variable in the root group with dimensions derived from NumberOfFrames, Rows, Columns, SamplesPerPixel, and PlanarConfiguration.
  • Pixel type is derived from BitsAllocated and PixelRepresentation.
  • Patient/Study/Series/Image Pixel module tags are mapped to global and variable attributes.
  • Data reading: NC_DICOM_get_vara() reads the requested frames via libdicom's dcm_filehandle_read_frame() and copies the hyperslab into the user buffer. JPEG frames are decompressed with libjpeg.
Author
Edward Hartnett
Date
2026-07-25

Function Documentation

◆ nc4_var_list_add()

int nc4_var_list_add ( NC_GRP_INFO_T * grp,
const char * name,
int ndims,
NC_VAR_INFO_T ** var )
extern

◆ NC_DICOM_abort()

int NC_DICOM_abort ( int ncid)

◆ NC_DICOM_close()

int NC_DICOM_close ( int ncid,
void * ignore )

◆ NC_DICOM_get_vara()

int NC_DICOM_get_vara ( int ncid,
int varid,
const size_t * start,
const size_t * count,
void * value,
nc_type memtype )

◆ NC_DICOM_inq_format()

int NC_DICOM_inq_format ( int ncid,
int * formatp )

◆ NC_DICOM_inq_format_extended()

int NC_DICOM_inq_format_extended ( int ncid,
int * formatp,
int * modep )

◆ NC_DICOM_open()

int NC_DICOM_open ( const char * path,
int mode,
int basepe,
size_t * chunksizehintp,
void * parameters,
const NC_Dispatch * dispatch,
int ncid )