SIGSEGV (Segmentation fault) on freeing memory vtkSmartPointer<vtkImageData> (NIFTY)

Use of a smart pointer is clearly the best/cleaner way. Another one without it, is simply to increment the reference counter on the data object:

  auto data = reader->GetOutput();
  this->niimg = data;
  this->niimg->Register(nullptr);

In this case, when the reader deletes the output data, it actually just decrements its reference counter.
Hope this helps,
J.