MCPcopy Create free account
hub / github.com/Kitware/VTK / ExecuteInformation

Method ExecuteInformation

IO/Image/vtkDICOMImageReader.cxx:102–227  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

100
101//------------------------------------------------------------------------------
102void vtkDICOMImageReader::ExecuteInformation()
103{
104 if (!this->GetStream() && this->FileName == nullptr && this->DirectoryName == nullptr)
105 {
106 return;
107 }
108
109 const auto parseInformation = [this]()
110 {
111 this->DICOMFileNames->clear();
112 this->AppHelper->Clear();
113 this->AppHelper->RegisterCallbacks(this->Parser);
114 this->Parser->ReadHeader();
115 this->SetupOutputInformation(1);
116 };
117
118 if (this->GetStream())
119 {
120 this->Parser->ClearAllDICOMTagCallbacks();
121 this->Streambuf = this->GetStream()->ToStreambuf();
122 std::istream* iStream = new std::istream(this->Streambuf.get());
123 this->Parser->OpenStream(iStream);
124 parseInformation();
125 }
126 if (this->FileName)
127 {
128 vtksys::SystemTools::Stat_t fs;
129 if (vtksys::SystemTools::Stat(this->FileName, &fs))
130 {
131 vtkErrorMacro("Unable to open file " << this->FileName);
132 return;
133 }
134 this->Parser->ClearAllDICOMTagCallbacks();
135 this->Parser->OpenFile(this->FileName);
136 parseInformation();
137 }
138 else if (this->DirectoryName)
139 {
140 vtkDirectory* dir = vtkDirectory::New();
141 int opened = dir->Open(this->DirectoryName);
142 if (!opened)
143 {
144 vtkErrorMacro("Couldn't open " << this->DirectoryName);
145 dir->Delete();
146 return;
147 }
148 vtkIdType numFiles = dir->GetNumberOfFiles();
149
150 vtkDebugMacro(<< "There are " << numFiles << " files in the directory.");
151
152 this->DICOMFileNames->clear();
153 this->AppHelper->Clear();
154
155 for (vtkIdType i = 0; i < numFiles; i++)
156 {
157 if (strcmp(dir->GetFile(i), ".") == 0 || strcmp(dir->GetFile(i), "..") == 0)
158 {
159 continue;

Callers

nothing calls this directly

Calls 15

CanReadFileMethod · 0.95
RegisterCallbacksMethod · 0.80
ToStreambufMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
GetStreamMethod · 0.45
clearMethod · 0.45
ClearMethod · 0.45
ReadHeaderMethod · 0.45

Tested by

no test coverage detected