00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : L.Taboni (Apr 2004) 00022 **=======================================================================*/ 00023 #ifndef _SO_VR_DICOM_DATA_ 00024 #define _SO_VR_DICOM_DATA_ 00025 00026 #include <Inventor/SbLinear.h> 00027 #include <Inventor/SbString.h> 00028 #include <Inventor/SbBox.h> 00029 #include <Inventor/SbPImpl.h> 00030 00031 #include <VolumeViz/readers/dicom/SiDicomDataSet.h> 00032 #include <VolumeViz/readers/dicom/SiDicomElement.h> 00033 00034 SO_PIMPL_BASE_PUBLIC_DECLARATION(SoVRDicomData); 00035 00063 class SoVRDicomData 00064 { 00065 SO_PIMPL_BASE_PUBLIC_HEADER(SoVRDicomData); 00066 public: 00067 00069 SoVRDicomData (); 00070 00072 ~SoVRDicomData (); 00073 00074 // header & image 00075 00080 SoNONUNICODE SbBool readDicomHeader (const char *fileName); 00081 00084 SbBool readDicomHeader (const SbString& fileName); 00085 00090 SoNONUNICODE SbBool readDicomImage (const char *fileName); 00091 00094 SbBool readDicomImage (const SbString& fileName); 00095 00099 SbBool close(); 00100 00101 // info from header 00102 00113 int getNumFrames () const; 00114 00116 int getImageWidth () const; 00117 00119 int getImageHeight () const; 00120 00122 int getSizeInBytes () const; 00123 00125 int getBytesPerPixel () const; 00126 00128 int getSamplesPerPixel () const; 00129 00131 SbBool supportedTransferSyntax () const; 00132 00133 #if 1 SoDEPRECATED 00139 const void *getImage () const; 00140 00141 #endif 00152 void readFrame( size_t frame, const SbBox2i32& subImg, uint8_t* dst ) const; 00153 00160 const SiDicomDataSet* getDicomDataSet() const; 00161 00162 // ACQUISITION info 00163 00169 float getSliceThicknessMM () const; 00170 00172 float getSliceSpacing () const; 00173 00174 // RELATION info 00175 00177 int getSeriesNumber () const; 00178 00180 int getImageNumber () const; 00181 00185 float getSliceLocation () const; 00186 00187 // IMAGE info 00188 00190 float getXPixelSize () const; 00191 00193 float getYPixelSize () const ; 00194 00204 SbBool getPosition(SbVec3f& position) const; 00205 00210 SbVec3f getImagePosition() const; 00211 00219 SbBool getOrientation(SbMatrix& orientation) const; 00220 00222 int getBitsStored () const; 00223 00225 int getHighBit () const; 00226 00228 int signedData () const; 00229 00231 float getIntercept () const; 00232 00234 float getSlope () const; 00235 00250 SbString getDicomInfo( unsigned short group, unsigned short element) const; 00251 00252 private: 00253 // The copying of SoVRDicomData is disabled because the copy will hold the 00254 // same ImageReader, that is not a correct behavior and can cause data races. 00255 SoVRDicomData( const SoVRDicomData& other ); 00256 SoVRDicomData& operator=( const SoVRDicomData& other ); 00257 00258 friend class SoVRDicomFileReader; 00259 00260 static SbThreadMutex s_iaMutex; 00261 }; 00262 00263 #endif /*_SO_VR_DICOM_DATA_*/ 00264