Copy link to clipboard
Copied
Hi all,
I'm working on a large number of DICOM files that are 200+ layers/frames each (ultrasound clips). I created an action that runs a script which performs a redaction of information on each layer. In the Automate > Batch window, I set the Destination as 'Save and Close' so that I don't need to manually click save everytime. Works like a charm, can get through a good number of ultrasound studies with minimal time.
Problem: there are a few files which are just a single layer (still DICOM, but a still image displaying a measurement on the screen). For some reason, the batch process grinds to a halt after performing the redaction and a 'Save As' dialog comes up asking me to save it. Weird thing is it defaults me to saving it as a .psd rather than a .dcm.
Hoping for some input so that I can run this batch and walk away without having to watch for these troublesome dialog boxes.
I'm running PS Ver 19.0. Let me know if any further info or screenshots are required, kind of new to PS
Thanks
D
The problem isn't your script, its the action you call from it.
You can branch the script if you want:
if(doc.layers.length == 1){
call action 1
}
else{
for(){
call action 2
}
}
Copy link to clipboard
Copied
You need to create two separate actions and separate the single files. No way around it. Actions cannot accomodate variations, they always use absolute settings "as is" when the action was created, including states of togglke switches such as the one for sequences. Could be that you could combine the two actions inside a parent action using conditional states to differentiate stills from sequences, but that's as good as it usually gets. this stuff is simply too dumb for its own good. If this is a regular requirment, you should look into scripting.
Mylenium
Copy link to clipboard
Copied
I actually needed to use a script to automate going through all the layers of the multi-layer images and performing the action. I copied it from somewhere online and replaced with my own action names, see below:
var doc = activeDocument;
for(var a = 0; a < doc.layers.length; a++){
doc.activeLayer = doc.layers;
app.doAction("redact", "dicom redaction");
}
any recommendation on how to edit it to make sure the single layer files can be treated like the multi-layer files?
cheers
d
Copy link to clipboard
Copied
The problem isn't your script, its the action you call from it.
You can branch the script if you want:
if(doc.layers.length == 1){
call action 1
}
else{
for(){
call action 2
}
}
Copy link to clipboard
Copied
Thanks for the reply.
The issue I found is that since the single layer images are, as the kids call it, a 'floating layer', it wants to save it as a psd rather than overwrite the original file. It's still weird to me because it still allows me to save as a dcm file if I choose it, it just pops up with a dialog box. I found if I flatten the image I can hit save and it will automatically overwrite the file rather than opening a dialog and defaulting the save as a psd.
My thoughts to fix this are to create another action that includes flattening the image, and then implementing it in a branched script as you said. I'll be close by as my scripting experience is only comprised of copy and pasting...
Copy link to clipboard
Copied
There are multiple ways to do this but a second action then edit the script to call the one you want is the best bet.
Copy link to clipboard
Copied
Actually, actions can have conditionals. See if you can create a master action that checks your files first and then processes them.