+
+ if (rubout)
+ {
+ if (boundVal[0]<0 || boundVal[0]>nX)
+ {
+ std::cout << "xBegin out of bounds; 'rubout' ignored" << std::endl;
+ fail = true;
+ }
+ if (boundVal[1]<0 || boundVal[1]>nX)
+ {
+ std::cout << "xEnd out of bounds; 'rubout' ignored" << std::endl;
+ fail = true;
+ }
+ if (boundVal[0] > boundVal[1])
+ {
+ std::cout << "xBegin greater than xEnd; 'rubout' ignored" << std::endl;
+ fail = true;
+ }
+ if (boundVal[2]<0 || boundVal[2]>nY)
+ {
+ std::cout << "yBegin out of bounds; 'rubout' ignored" << std::endl;
+ fail = true;
+ }
+ if (boundVal[3]<0 || boundVal[3]>nY)
+ {
+ std::cout << "yEnd out of bounds; 'rubout' ignored" << std::endl;
+ fail = true;
+ }
+ if (boundVal[2] > boundVal[3])
+ {
+ std::cout << "yBegin greater than yEnd; 'rubout' ignored" << std::endl;
+ fail = true;
+ }
+ if (!fail)
+ {
+ int pixelLength = f->GetBitsAllocated()/8;
+ int lineLength = nX * sPP * pixelLength;
+ size_t lengthToRubout = (boundVal[1]-boundVal[0])*sPP*pixelLength;
+ int offsetToBeginOfRubout = boundVal[0]*sPP*pixelLength+lineLength*boundVal[2];
+
+ for(int rbl=boundVal[2]; rbl<boundVal[3];rbl++)
+ {
+ memset((char *)imageData+offsetToBeginOfRubout, ruboutVal, lengthToRubout);
+ offsetToBeginOfRubout += lineLength;
+ }
+ }
+ }