function IV_filt = normaliseiv(IV, window_size, particle_size, min_brightness)
	% perform particle image normalisation for intensity volume IV
	% PIV window size is given by window_size, a 3x1 vector
	% typical particle size is given by particle_size, a 3x1 vector
	
	% window size and particle size must be odd
	window_size					= floor(window_size/2)*2 + 1;
	particle_size				= floor(particle_size/2)*2 + 1;
	
	%% subtract sliding minimum
	minval						= minfiltnd(IV, window_size);
	IV_filt						= IV - minval;
	clear minval;

	%% sliding maximum filter, on the lengthscale of a particle
	% picks out the brightness of individual particles
	local_maximum				= maxfiltnd(IV_filt, particle_size);
	
	%% if no minimum brightness is supplied, enter interactive mode to pick
	% minimum brightness
	if nargin < 4
		bDone						= false;
		ix							= floor(size(IV,1)/2);
		iy							= floor(size(IV,2)/2);
		iz							= floor(size(IV,3)/2);
		f							= figure();
		while ~bDone
			%% query user
			min_brightness		= input('Enter minimum brightness for normalisation: ');
			
			%% create plot
			IV_test_xy			= IV_filt(:,:,iz) ./ max(min_brightness, local_maximum(:,:,iz));
			IV_test_xz			= IV_filt(:,iy,:) ./ max(min_brightness, local_maximum(:,iy,:));
			IV_test_yz			= IV_filt(ix,:,:) ./ max(min_brightness, local_maximum(ix,:,:));
			figure(f);
			
			subplot(4,4,[1:3 5:7 9:11]);
			imagesc(IV_test_xy');
			hax = gca;
			title(sprintf('Normalisation in x-y plane (z=%d) with minimum threshold = %0.1f', iz, min_brightness));
			axis equal tight;
			
			subplot(4,4,[4 8 12]);
			imagesc(squeeze(IV_test_yz));
			axis equal tight;
			title(sprintf('Normalisation in y-z plane (x=%d) with minimum threshold = %0.1f', ix, min_brightness));
			
			subplot(4,4,13:15);
			imagesc(squeeze(IV_test_xz)');
			axis equal tight;
			title(sprintf('Normalisation in x-z plane (y=%d) with minimum threshold = %0.1f', iy, min_brightness));
			
			%% check if acceptable
			sDone					= input('Accept threshold? y/n', 's');
			if strcmpi(sDone, 'y')
				bDone				= true;
			end
		end
	end
	
	%% normalise by local maximum
	% so long as it is above threshold of a typical particle
	IV_filt						= IV_filt ./ max(local_maximum, min_brightness);
end

