If you don't want to use an existing library you have to implement it yourself. You have to read the DICOM file format specifications and implement reading and parsing of the files to extract the required information.
See
DICOM - Wikipedia[
^] and there the External Links section:
DICOM Homepage[
^]
But because you are an beginner I suggest to have a look at the source code of some open source DICOM libraries which might be used as a starting point.