xp_comm_proj/rd_dicom/Papyrus3/PapyDataSetRead3.c
/********************************************************************************/
/*									 	*/
/*	ExtractDicomDataSetInformation3 : Extracts the data sets relativ 	*/
/*	information i.e. the offsets to the data sets and the pixel datas for 	*/
/*	a DICOM file.								*/
/*	return : standard error message.					*/
/*										*/
/********************************************************************************/
ExtractDicomDataSetInformation3 : Extracts the data sets relativ
information i.e. the offsets to the data sets and the pixel datas for
a DICOM file.
return : standard error message.
ExtractDicomDataSetInformation3 : Extracts the data sets relativ information i . e . the offsets to the data sets and the pixel datas for a DICOM file . return : standard error message .
PapyShort
ExtractDicomDataSetInformation3 (PapyShort inFileNb)
{
  PapyShort	theErr, i;
  PapyULong	theULong;
  PapyULong	theOffsetDataSet, theOffsetImage;
  if ((theErr = Papy3GotoGroupNb (inFileNb, 0x7FE0)) < 0) RETURN (theErr);
  if ((theErr = Papy3GotoElemNb (inFileNb, 0x7FE0, 0x0010, &theULong)) < 0) RETURN (theErr);
  Papy3FTell (gPapyFile [inFileNb], (PapyLong *) &theOffsetImage);
  if (gArrTransfSyntax [inFileNb] == LITTLE_ENDIAN_EXPL || 
      gArrTransfSyntax [inFileNb] == BIG_ENDIAN_EXPL) theOffsetImage += 12L;
  else theOffsetImage += 8L;
  if (gIsPapyFile [inFileNb] == DICOM10) theOffsetDataSet = 132L;
  else if (gIsPapyFile [inFileNb] == DICOM_NOT10) theOffsetDataSet = 0L;
  gRefImagePointer [inFileNb] = (PapyULong *) ecalloc3 ((PapyULong) gArrNbImages [inFileNb], 
    						     (PapyULong) sizeof (PapyULong));
  gRefPixelOffset  [inFileNb] = (PapyULong *) ecalloc3 ((PapyULong) gArrNbImages [inFileNb], 
    						     (PapyULong) sizeof (PapyULong));
  for (i = 0; i < gArrNbImages [inFileNb]; i++)
  {
    *(gRefImagePointer [inFileNb] + i) = theOffsetDataSet;
    *(gRefPixelOffset [inFileNb] + i) = theOffsetImage;
  } 
  return 0;
}
PapyShort ExtractDicomDataSetInformation3 ( PapyShort inFileNb ) { PapyShort theErr , i ; PapyULong theULong ; PapyULong theOffsetDataSet , theOffsetImage ; if ( ( theErr = Papy3GotoGroupNb ( inFileNb , 0x7FE0 ) ) < 0 ) RETURN ( theErr ) ; if ( ( theErr = Papy3GotoElemNb ( inFileNb , 0x7FE0 , 0x0010 , & theULong ) ) < 0 ) RETURN ( theErr ) ; Papy3FTell ( gPapyFile [ inFileNb ] , ( PapyLong * ) & theOffsetImage ) ; if ( gArrTransfSyntax [ inFileNb ] == LITTLE_ENDIAN_EXPL || gArrTransfSyntax [ inFileNb ] == BIG_ENDIAN_EXPL ) theOffsetImage += 12L ; else theOffsetImage += 8L ; if ( gIsPapyFile [ inFileNb ] == DICOM10 ) theOffsetDataSet = 132L ; else if ( gIsPapyFile [ inFileNb ] == DICOM_NOT10 ) theOffsetDataSet = 0L ; gRefImagePointer [ inFileNb ] = ( PapyULong * ) ecalloc3 ( ( PapyULong ) gArrNbImages [ inFileNb ] , ( PapyULong ) sizeof ( PapyULong ) ) ; gRefPixelOffset [ inFileNb ] = ( PapyULong * ) ecalloc3 ( ( PapyULong ) gArrNbImages [ inFileNb ] , ( PapyULong ) sizeof ( PapyULong ) ) ; for ( i = 0 ; i < gArrNbImages [ inFileNb ] ; i ++ ) { * ( gRefImagePointer [ inFileNb ] + i ) = theOffsetDataSet ; * ( gRefPixelOffset [ inFileNb ] + i ) = theOffsetImage ; } return 0 ; }
ExtractDicomDataSetInformation3 : Extracts the data sets relativ
information i.e.
ExtractDicomDataSetInformation3 : Extracts the data sets relativ information i . e .
/* move the file pointer to group 0x7FE0 */ /* look for the position of the image pixel element */ /* elem (0x7FE0, 0x0010) = image pixel */ /* get the position of the element */ /* add something depending on the transfert syntax */ /* set the position of the unique data set */ /* part 10 compliant DICOM file */ /* non-part 10 DICOM file */ /* allocate room for the offsets to the data set and pixel data of the file */ /* put the offset to data set and the image for each image */ /* put the offset to the data set */ /* put the offset to the pixel datas */ /* for ...putting the offsets to data set and the images */