1. A method of measuring a property of a target structure on a substrate, the method comprising: obtaining an image of the target structure using a predetermined portion of radiation diffracted by the target structure under illumination; defining candidate regions of interest each comprising a plurality of pixels in the obtained image, wherein the candidate regions of interest's differ from one another in two or more parameters, the two or more parameters defining (i) which pixels of the obtained image are contained within that respective one of the candidate regions of interest and (ii) the respective ones of the candidate regions of interest position in the obtained image; defining an optimization metric value for the candidate regions of interest based at least partly on pixel signal values of the plurality of pixels within each of the candidate regions of interest; defining a target signal function which defines a contribution of each pixel in the obtained image to a target signal value, the contribution of each pixel depending on (i) which respective ones of the candidate regions of interest contain that pixel and (ii) optimization metric values of the respective ones of the candidate regions of interest; obtaining a measurement of the property of the target structure or a different target structure using the target signal value determined by combining multiple pixel signal values from the obtained image in accordance with the defined target signal function; and storing the measurement in a memory such that adjustments to exposure of subsequent substrates or reworking of the substrate with the target structure can be done using the measurement to improve yield.