1. A method for removing noise from an image, comprising: receiving image data including a plurality of pixels; formulating a graph including a plurality of nodes and a plurality of edges interconnecting the nodes, wherein each pixel of the image data is represented as a node of the graph and each edge of the graph is assigned a weight based on a penalty function applied to the nodes connected by the edge; minimizing a total penalty of the graph; and providing a denoised image based on the total penalty-minimized graph, wherein the penalty function is less when a value of a given pixel of the plurality of pixels is between or equal to the values of two neighboring pixels than when the value of the given pixel is either greater than or less than the values of both of the two neighboring pixels.