I notice that I have a memory build up then eventually crashes my program after calling
load about 3 times. Everything I call
load it will create new pipelines and eventually ends in a VTK image viewer. there is only 1 image viewer which I call SetInputData again to load the new data. But how do I make sure that the previous pipeline is deleted before loading the new one?
def load(): ... # these are just ITK source -> filter pipes dicomSource, dicom = DicomModel(series[uid]) labelSource, label = LabelMapModel(dicom.GetOutput(), ndarr=argMax) overlay = OverlayModel(series[uid], ndarr=argMax) # load models into VTK image viewer sliceViewTL.loadImage(ItkToVtkFilter(dicom.GetOutput()).GetOutput()) sliceViewTR.loadImage(ItkToVtkFilter(label.GetOutput()).GetOutput()) sliceViewBL.loadImage(ItkToVtkFilter(overlay.GetOutput()).GetOutput()) ...