|
29 | 29 |
|
30 | 30 | namespace iseg {
|
31 | 31 |
|
32 |
| -bool VTIreader::GetSlice(const char* filename, float* slice, unsigned slicenr, unsigned width, unsigned height) |
| 32 | +bool VTIreader::GetSlice(const std::string& filename, float* slice, unsigned slicenr, unsigned width, unsigned height) |
33 | 33 | {
|
34 | 34 | vtkXMLImageDataReader* reader = vtkXMLImageDataReader::New();
|
35 |
| - if (reader->CanReadFile(filename) == 0) |
| 35 | + if (reader->CanReadFile(filename.c_str()) == 0) |
36 | 36 | {
|
37 | 37 | return false;
|
38 | 38 | }
|
39 |
| - reader->SetFileName(filename); |
| 39 | + reader->SetFileName(filename.c_str()); |
40 | 40 | reader->Update();
|
41 | 41 |
|
42 | 42 | int ext[6] = {0, 0, 0, 0, 0, 0};
|
@@ -104,14 +104,14 @@ bool VTIreader::GetSlice(const char* filename, float* slice, unsigned slicenr, u
|
104 | 104 | return true;
|
105 | 105 | }
|
106 | 106 |
|
107 |
| -float* VTIreader::GetSliceInfo(const char* filename, unsigned slicenr, unsigned& width, unsigned& height) |
| 107 | +float* VTIreader::GetSliceInfo(const std::string& filename, unsigned slicenr, unsigned& width, unsigned& height) |
108 | 108 | {
|
109 | 109 | vtkXMLImageDataReader* reader = vtkXMLImageDataReader::New();
|
110 |
| - if (reader->CanReadFile(filename) == 0) |
| 110 | + if (reader->CanReadFile(filename.c_str()) == 0) |
111 | 111 | {
|
112 | 112 | return nullptr;
|
113 | 113 | }
|
114 |
| - reader->SetFileName(filename); |
| 114 | + reader->SetFileName(filename.c_str()); |
115 | 115 | reader->Update();
|
116 | 116 |
|
117 | 117 | int ext[6] = {0, 0, 0, 0, 0, 0};
|
@@ -179,16 +179,16 @@ float* VTIreader::GetSliceInfo(const char* filename, unsigned slicenr, unsigned&
|
179 | 179 | return slice;
|
180 | 180 | }
|
181 | 181 |
|
182 |
| -bool VTIreader::GetVolume(const char* filename, float** slices, unsigned nrslices, unsigned width, unsigned height, const std::string& arrayName) |
| 182 | +bool VTIreader::GetVolume(const std::string& filename, float** slices, unsigned nrslices, unsigned width, unsigned height, const std::string& arrayName) |
183 | 183 | {
|
184 | 184 | vtkXMLImageDataReader* reader = vtkXMLImageDataReader::New();
|
185 |
| - if (reader->CanReadFile(filename) == 0) |
| 185 | + if (reader->CanReadFile(filename.c_str()) == 0) |
186 | 186 | {
|
187 | 187 | std::cerr << "VTIreader::getVolume() : can not read file " << filename
|
188 | 188 | << endl;
|
189 | 189 | return false;
|
190 | 190 | }
|
191 |
| - reader->SetFileName(filename); |
| 191 | + reader->SetFileName(filename.c_str()); |
192 | 192 | reader->Update();
|
193 | 193 |
|
194 | 194 | int ext[6] = {0, 0, 0, 0, 0, 0};
|
@@ -268,14 +268,14 @@ bool VTIreader::GetVolume(const char* filename, float** slices, unsigned nrslice
|
268 | 268 | return true;
|
269 | 269 | }
|
270 | 270 |
|
271 |
| -bool VTIreader::GetVolumeAll(const char* filename, float** slicesbmp, float** sliceswork, tissues_size_t** slicestissue, unsigned nrslices, unsigned width, unsigned height) |
| 271 | +bool VTIreader::GetVolumeAll(const std::string& filename, float** slicesbmp, float** sliceswork, tissues_size_t** slicestissue, unsigned nrslices, unsigned width, unsigned height) |
272 | 272 | {
|
273 | 273 | vtkXMLImageDataReader* reader = vtkXMLImageDataReader::New();
|
274 |
| - if (reader->CanReadFile(filename) == 0) |
| 274 | + if (reader->CanReadFile(filename.c_str()) == 0) |
275 | 275 | {
|
276 | 276 | return false;
|
277 | 277 | }
|
278 |
| - reader->SetFileName(filename); |
| 278 | + reader->SetFileName(filename.c_str()); |
279 | 279 | reader->Update();
|
280 | 280 |
|
281 | 281 | int ext[6] = {0, 0, 0, 0, 0, 0};
|
@@ -394,14 +394,14 @@ bool VTIreader::GetVolumeAll(const char* filename, float** slicesbmp, float** sl
|
394 | 394 | return true;
|
395 | 395 | }
|
396 | 396 |
|
397 |
| -bool VTIreader::GetVolume(const char* filename, float** slices, unsigned startslice, unsigned nrslices, unsigned width, unsigned height, const std::string& arrayName) |
| 397 | +bool VTIreader::GetVolume(const std::string& filename, float** slices, unsigned startslice, unsigned nrslices, unsigned width, unsigned height, const std::string& arrayName) |
398 | 398 | {
|
399 | 399 | vtkXMLImageDataReader* reader = vtkXMLImageDataReader::New();
|
400 |
| - if (reader->CanReadFile(filename) == 0) |
| 400 | + if (reader->CanReadFile(filename.c_str()) == 0) |
401 | 401 | {
|
402 | 402 | return false;
|
403 | 403 | }
|
404 |
| - reader->SetFileName(filename); |
| 404 | + reader->SetFileName(filename.c_str()); |
405 | 405 | reader->Update();
|
406 | 406 |
|
407 | 407 | int ext[6] = {0, 0, 0, 0, 0, 0};
|
@@ -480,14 +480,14 @@ bool VTIreader::GetVolume(const char* filename, float** slices, unsigned startsl
|
480 | 480 | return true;
|
481 | 481 | }
|
482 | 482 |
|
483 |
| -bool VTIreader::GetInfo(const char* filename, unsigned& width, unsigned& height, unsigned& nrslices, float* pixelsize, float* offset, std::vector<std::string>& arrayNames) |
| 483 | +bool VTIreader::GetInfo(const std::string& filename, unsigned& width, unsigned& height, unsigned& nrslices, float* pixelsize, float* offset, std::vector<std::string>& arrayNames) |
484 | 484 | {
|
485 | 485 | vtkXMLImageDataReader* reader = vtkXMLImageDataReader::New();
|
486 |
| - if (reader->CanReadFile(filename) == 0) |
| 486 | + if (reader->CanReadFile(filename.c_str()) == 0) |
487 | 487 | {
|
488 | 488 | return false;
|
489 | 489 | }
|
490 |
| - reader->SetFileName(filename); |
| 490 | + reader->SetFileName(filename.c_str()); |
491 | 491 | reader->UpdateInformation();
|
492 | 492 | int extent[6];
|
493 | 493 | double spacing[3];
|
@@ -528,7 +528,7 @@ bool VTIreader::GetInfo(const char* filename, unsigned& width, unsigned& height,
|
528 | 528 | return true;
|
529 | 529 | }
|
530 | 530 |
|
531 |
| -bool VTIwriter::WriteVolumeAll(const char* filename, float** slicesbmp, float** sliceswork, tissues_size_t** slicestissue, tissues_size_t nrtissues, unsigned nrslices, unsigned width, unsigned height, float* pixelsize, float* offset, bool binary, bool compress) |
| 531 | +bool VTIwriter::WriteVolumeAll(const std::string& filename, float** slicesbmp, float** sliceswork, tissues_size_t** slicestissue, tissues_size_t nrtissues, unsigned nrslices, unsigned width, unsigned height, float* pixelsize, float* offset, bool binary, bool compress) |
532 | 532 | {
|
533 | 533 | vtkSmartPointer<vtkImageData> input = vtkSmartPointer<vtkImageData>::New();
|
534 | 534 | input->SetExtent(0, (int)width - 1, 0, (int)height - 1, 0, (int)nrslices - 1);
|
@@ -650,7 +650,7 @@ bool VTIwriter::WriteVolumeAll(const char* filename, float** slicesbmp, float**
|
650 | 650 | writer->SetDataModeToAppended();
|
651 | 651 | if (binary)
|
652 | 652 | writer->EncodeAppendedDataOff();
|
653 |
| - writer->SetFileName(filename); |
| 653 | + writer->SetFileName(filename.c_str()); |
654 | 654 | writer->Write();
|
655 | 655 |
|
656 | 656 | return true;
|
|
0 commit comments