Optimization of Q-factor in direct-coupled cavity-waveguide photonic crystal structures