From: Mathieu M. <mat...@gm...> - 2008-05-19 13:54:46
|
gdcm.Reader & gdcm.ImageReader both return GetFile() so both should be fine. gdcm.Reader succeed even if DICOM file is not an image, that's the difference. -M On Mon, May 19, 2008 at 3:52 PM, Paulo Henrique Junqueira Amorim <pau...@gm...> wrote: > The sf.SetFile(file) is read from gdcm.ImageReader ? > > > > 2008/5/19 Mathieu Malaterre <mat...@gm...>: >> >> Hi Paulo, >> >> you need to use the StringFilter filter. Tag: 0x0028, 0x0103 is not >> ASCII, it is a binary value and is loaded as such into memory. To make >> is easy for human to read value, one can use the StringFilter for this >> case: >> >> sf = gdcm.StringFilter() >> sf.SetFile(file) # extremely important >> res = sf.ToStringPair( gdcm.Tag(0x0028, 0x0103) ) >> print res[1] >> >> As a side note you can also have a look at TestStringFilter.py >> >> HTH >> >> On Mon, May 19, 2008 at 3:30 PM, Paulo Henrique Junqueira Amorim >> <pau...@gm...> wrote: >> > Hi Mathieu, >> > >> > My problem is Pixel Representation gdcm return 2. >> > >> > I tried on several dicom. Other programs return 1 and 0 to same dicom. >> > >> > Some definitions say it's # 1 signed, 0 unsigned >> > >> > as I can get 0 or 1? >> > >> > >> > class ivMedicalImageParser(): >> > >> > def __init__(self): >> > self.file_name = None >> > self.read_dicom = vtkgdcm.vtkGDCMImageReader() >> > >> > def SetFileName(self, file_name): >> > self.file_name = file_name >> > self.read_dicom_gdcm = gdcm.ImageReader() >> > self.read_dicom_gdcm.SetFileName(file_name) >> > >> > if (self.read_dicom_gdcm.Read()): >> > self.read_dicom.SetFileName(file_name) >> > self.read_dicom.Update() >> > else: >> > self.file_name = None >> > >> > def GetPixelRepresentation(self): >> > tag = gdcm.Tag(0x0028, 0x0103) >> > ds = self.read_dicom_gdcm.GetFile().GetDataSet() >> > if ds.FindDataElement(tag): >> > inf = str(ds.GetDataElement(tag).GetValue()) >> > if (inf): >> > return inf.split("Loaded:")[1] >> > else: >> > return None >> > >> > >> > >> >> >> >> -- >> Mathieu > > -- Mathieu |