| 1406 | // --------------------------------------------------------------------- |
| 1407 | |
| 1408 | void ImageRD::SaveFile(const char* filename,const Properties& render_settings,bool generate_initial_pattern_when_loading) const |
| 1409 | { |
| 1410 | // convert the image to named arrays |
| 1411 | vtkSmartPointer<vtkImageData> im = vtkSmartPointer<vtkImageData>::New(); |
| 1412 | im->DeepCopy(this->images.front()); |
| 1413 | im->GetPointData()->SetScalars(NULL); |
| 1414 | for(int iChem=0;iChem<this->GetNumberOfChemicals();iChem++) |
| 1415 | { |
| 1416 | vtkSmartPointer<vtkDataArray> da = vtkSmartPointer<vtkDataArray>::Take( vtkDataArray::CreateDataArray( this->data_type ) ); |
| 1417 | da->DeepCopy(this->images[iChem]->GetPointData()->GetScalars()); |
| 1418 | da->SetName(GetChemicalName(iChem).c_str()); |
| 1419 | im->GetPointData()->AddArray(da); |
| 1420 | } |
| 1421 | |
| 1422 | vtkSmartPointer<RD_XMLImageWriter> iw = vtkSmartPointer<RD_XMLImageWriter>::New(); |
| 1423 | iw->SetSystem(this); |
| 1424 | iw->SetRenderSettings(&render_settings); |
| 1425 | if(generate_initial_pattern_when_loading) |
| 1426 | iw->GenerateInitialPatternWhenLoading(); |
| 1427 | iw->SetFileName(filename); |
| 1428 | iw->SetDataModeToBinary(); // (to match MeshRD::SaveFile()) |
| 1429 | iw->SetInputData(im); |
| 1430 | iw->Write(); |
| 1431 | } |
| 1432 | |
| 1433 | // -------------------------------------------------------------------------------- |
| 1434 |
nothing calls this directly
no test coverage detected