ScalarImageType::Pointer loadScalarImage(const std::string& filename) { itk::ImageFileReader<ScalarImageType>::Pointer reader = itk::ImageFileReader<ScalarImageType>::New(); reader->SetFileName(filename); reader->Update(); ScalarImageType::Pointer img = reader->GetOutput(); img->DisconnectPipeline(); return img; }
WeightedLeastSquares::ImageListType WeightedLeastSquares::ComputeDifferenceImage(ImageListType PredImageList) { ImageListType DifferenceImageList; int numOfImages = m_DWIListHR.size(); for (int i=0; i < numOfImages; i++) { SubtractImageFilterType::Pointer subtractImageFilter = SubtractImageFilterType::New(); subtractImageFilter->SetInput1(m_DWIListHR[i]); subtractImageFilter->SetInput2(PredImageList[i]); subtractImageFilter->Update(); ScalarImageType::Pointer diffImage = subtractImageFilter->GetOutput(); diffImage->DisconnectPipeline(); DifferenceImageList.push_back(diffImage); } return DifferenceImageList; }