Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "mitkPACSPlugin.h"
00019
00020 #include <iostream>
00021
00022 mitk::PACSPlugin* mitk::PACSPlugin::GetInstance(bool destroyInstance)
00023 {
00024 static mitk::PACSPlugin::Pointer s_Instance = mitk::PACSPlugin::New();
00025
00026 if( destroyInstance )
00027 {
00028 s_Instance = NULL;
00029 }
00030
00031 return s_Instance;
00032 }
00033
00034
00035 mitk::PACSPlugin::PACSPlugin()
00036 : m_ReaderType(0)
00037 {
00038 }
00039
00040
00041 mitk::PACSPlugin::~PACSPlugin()
00042 {
00043 }
00044
00045
00046 mitk::PACSPlugin::PACSPluginCapability mitk::PACSPlugin::GetPluginCapabilities()
00047 {
00048 PACSPluginCapability result;
00049 result.IsPACSFunctional = false;
00050 result.HasLoadCapability = false;
00051 result.HasSaveCapability = false;
00052 return result;
00053 }
00054
00055
00056 mitk::PACSPlugin::PatientInformationList mitk::PACSPlugin::GetPatientInformationList()
00057 {
00058 PatientInformationList emptyResult;
00059 emptyResult.clear();
00060 return emptyResult;
00061 }
00062
00063
00064 mitk::PACSPlugin::StudyInformationList mitk::PACSPlugin::GetStudyInformationList( const PatientInformation& )
00065 {
00066 StudyInformationList emptyResult;
00067 emptyResult.clear();
00068 return emptyResult;
00069 }
00070
00071
00072 mitk::PACSPlugin::SeriesInformationList mitk::PACSPlugin::GetSeriesInformationList( const std::string& )
00073 {
00074 SeriesInformationList emptyResult;
00075 emptyResult.clear();
00076 return emptyResult;
00077 }
00078
00079
00080 mitk::PACSPlugin::DocumentInformationList mitk::PACSPlugin::GetDocumentInformationList( const std::string& )
00081 {
00082 DocumentInformationList emptyResult;
00083 emptyResult.clear();
00084 return emptyResult;
00085 }
00086
00087
00088 mitk::PACSPlugin::PatientInformation mitk::PACSPlugin::GetPatientInformation( const std::string& )
00089 {
00090 PatientInformation emptyResult;
00091 emptyResult.PatientsSex = "O";
00092 emptyResult.PatientComments = "No PACS connectivity implemented or configured. Cannot query patient";
00093 return emptyResult;
00094 }
00095
00096
00097 mitk::PACSPlugin::StudyInformation mitk::PACSPlugin::GetStudyInformation( const std::string& )
00098 {
00099 StudyInformation emptyResult;
00100 emptyResult.StudyDescription = "No PACS connectivity implemented or configured. Cannot query study";
00101 return emptyResult;
00102 }
00103
00104
00105 mitk::PACSPlugin::SeriesInformation mitk::PACSPlugin::GetSeriesInformation( const std::string& )
00106 {
00107 SeriesInformation emptyResult;
00108 emptyResult.SeriesDescription = "No PACS connectivity implemented or configured. Cannot query series.";
00109 return emptyResult;
00110 }
00111
00112
00113 mitk::PACSPlugin::DocumentInformation mitk::PACSPlugin::GetDocumentInformation( const std::string& itkNotUsed(seriesInstanceUID),
00114 unsigned int itkNotUsed(instanceNumber) )
00115 {
00116 DocumentInformation emptyResult;
00117 return emptyResult;
00118 }
00119
00120
00121 unsigned int mitk::PACSPlugin::GetLightboxCount()
00122 {
00123 return 0;
00124 }
00125
00126
00127 unsigned int mitk::PACSPlugin::GetActiveLightbox()
00128 {
00129 return (unsigned int)-1;
00130 }
00131
00132
00133 void mitk::PACSPlugin::SetReaderType( unsigned int readerType )
00134 {
00135 m_ReaderType = readerType;
00136 }
00137
00138
00139 void mitk::PACSPlugin::AbortPACSImport()
00140 {
00141 }
00142
00143
00144 std::vector<mitk::DataNode::Pointer> mitk::PACSPlugin::LoadImagesFromLightbox( unsigned int itkNotUsed(lightboxIndex) )
00145 {
00146 std::vector<DataNode::Pointer> emptyVector;
00147 emptyVector.clear();
00148 return emptyVector;
00149 }
00150
00151
00152 std::vector<mitk::DataNode::Pointer> mitk::PACSPlugin::LoadFromSeries( const std::string& seriesInstanceUID )
00153 {
00154 std::vector<DataNode::Pointer> resultVector = this->LoadImagesFromSeries( seriesInstanceUID );
00155 std::vector<DataNode::Pointer> secondResultVector = this->LoadTextsFromSeries( seriesInstanceUID );
00156 resultVector.insert( resultVector.end(), secondResultVector.begin(), secondResultVector.end() );
00157 return resultVector;
00158 }
00159
00160
00161 std::vector<mitk::DataNode::Pointer> mitk::PACSPlugin::LoadImagesFromSeries( const std::string& )
00162 {
00163 std::vector<DataNode::Pointer> emptyVector;
00164 emptyVector.clear();
00165 return emptyVector;
00166 }
00167
00168 std::vector<mitk::DataNode::Pointer> mitk::PACSPlugin::LoadImagesFromSeries( std::vector<std::string> )
00169 {
00170 std::vector<DataNode::Pointer> emptyVector;
00171 emptyVector.clear();
00172 return emptyVector;
00173 }
00174
00175
00176 std::vector<mitk::DataNode::Pointer> mitk::PACSPlugin::LoadTextsFromSeries( const std::string& )
00177 {
00178 std::vector<DataNode::Pointer> emptyVector;
00179 emptyVector.clear();
00180 return emptyVector;
00181 }
00182
00183
00184 mitk::DataNode::Pointer mitk::PACSPlugin::LoadSingleText( const std::string& , unsigned int )
00185 {
00186 return NULL;
00187 }
00188
00189
00190 void mitk::PACSPlugin::SaveAsNewSeries( DataStorage::SetOfObjects::ConstPointer ,
00191 const std::string& ,
00192 int ,
00193 const std::string& )
00194 {
00195 }
00196
00197
00198 void mitk::PACSPlugin::SaveToSeries( DataStorage::SetOfObjects::ConstPointer ,
00199 const std::string& ,
00200 bool )
00201 {
00202 }
00203
00204 void mitk::PACSPlugin::UploadFileAsNewSeries( const std::string& ,
00205 const std::string& ,
00206 const std::string& ,
00207 int ,
00208 const std::string& )
00209 {
00210 }
00211
00212 void mitk::PACSPlugin::UploadFileToSeries( const std::string& ,
00213 const std::string& ,
00214 const std::string& ,
00215 const std::string& ,
00216 bool )
00217 {
00218 }
00219
00220 std::string mitk::PACSPlugin::GuessMIMEType( const std::string& filename )
00221 {
00222 std::ifstream file( filename.c_str() );
00223 if (!file)
00224 {
00225
00226 return std::string("");
00227 }
00228
00229 const unsigned int maxLength = 8;
00230 unsigned char line[ maxLength];
00231 file.getline( reinterpret_cast<char*>(line), maxLength );
00232 file.close();
00233
00234 std::string firstLine( reinterpret_cast<char*>(line) );
00235
00236 if ( firstLine.substr( 1, 3 ) == "PDF" )
00237 {
00238 return std::string("application/pdf");
00239 }
00240
00241 if ( firstLine.substr( 0, 5 ) == "{\rtf" )
00242 {
00243 return std::string("text/richtext");
00244 }
00245
00246 if ( firstLine.substr( 0, 2 ) == "PK" )
00247 {
00248 return std::string("application/zip");
00249 }
00250
00251 if ( (line[0] == 0xFF) && (line[1] == 0xD8) )
00252 {
00253 return std::string("image/jpeg");
00254 }
00255
00256 if ( (line[0] == 0x89) &&
00257 (line[1] == 0x50) &&
00258 (line[2] == 0x4E) &&
00259 (line[3] == 0x47) &&
00260 (line[4] == 0x0D) &&
00261 (line[5] == 0x0A) &&
00262 (line[6] == 0x1A) &&
00263 (line[7] == 0x0A)
00264 )
00265 {
00266 return std::string("image/png");
00267 }
00268
00269 if ( (line[0] == 0x4D) && (line[1] == 0x5A) )
00270 {
00271
00272 return std::string("Windows EXE");
00273 }
00274
00275 if ( ( filename.rfind( ".stl" ) == filename.length() - 4 ) ||
00276 ( filename.rfind( ".STL" ) == filename.length() - 4 ) )
00277 {
00278
00279 return std::string("application/sla");
00280 }
00281
00282 if ( ( filename.rfind( ".txt" ) == filename.length() - 4 ) ||
00283 ( filename.rfind( ".TXT" ) == filename.length() - 4 ) )
00284 {
00285
00286 return std::string("text/plain");
00287 }
00288
00289 return std::string("");
00290 }
00291
00292
00293 void mitk::PACSPlugin::DownloadSingleFile( const std::string& ,
00294 unsigned int ,
00295 const std::string& )
00296 {
00297 }