def get_qpimage(self, idx):
<EOL>qpi = self.get_qpimage_raw(idx)<EOL>if "<STR_LIT>" not in qpi:<EOL><INDENT>msg = "<STR_LIT>"+ "<STR_LIT>".format(self.__class__)<EOL>raise KeyError(msg)<EOL><DEDENT>if self._bgdata:<EOL><INDENT>if len(self._bgdata) == <NUM_LIT:1>:<EOL><INDENT>bgidx = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>bgidx = idx<EOL><DEDENT>if isinstance(self._bgdata, SeriesData):<EOL><INDENT>bg = self._bgdata.get_qpimage_raw(bgidx)<EOL><DEDENT>else:<EOL><INDENT>bg = self._bgdata[bgidx]<EOL><DEDENT>qpi.set_bg_data(bg_data=bg)<EOL><DEDENT>return qpi<EOL>
Return background-corrected QPImage of data at index `idx`