I have asked endodontist for some of my personal medical dental records and they refused to give me all photos. Is that legal?

Well... Your dental record legally belongs to you. The endodontist can charge you for the reproduction of them, but that's about it. Most photos are electronic, they can be emailed. I'm not sure why you would need all of them' but that's not the point.
See below. They can't give you the originals because they need it for the record but they should give you copies (at your expense) of your records. Perhaps, they don't have a way of reproducing the photos - ask them why.
Dental records. To the best of my knowledge throughout the us patients are entitled to a copy of all medical (dental) records. Doctors can charge a reasonable fee for duplication of all records as the originals are the property of the treating doctor. If you really need\want ones that were refused to you, you can contact your local and state dental society, state licensing department and a lawyer.
You do not need them. You do not need the photos of your endodontic operative photos. Any dentist can see what was done with one radiograph, which should be taken annually to evaluate healing. These photos are expensive to print taking valuable staff time. I am sure the endodontist will be happy to forward post-operative radiographs to any dentist you wish. Forget the pictures!