[ome-users] question when using bfconvert

Curtis Rueden ctrueden at wisc.edu
Fri Dec 5 23:32:23 GMT 2014


Hi Fangfei,

> I want to have file name like
> image_xy0000_c0_t00.tiff, i.e.,4 digits for series,
> 1 digit for channel, and two digit for time.

Here is a little shell script:

for f in *.tiff
do
  s1="${f#*_xy}"
  s2="${f#*_c}"
  s3="${f#*_t}"
  prefix="${f%%_xy*}"
  ext="${f##*.}"
  xy="$(printf "%05d" ${s1%%_*})"
  c="$(printf "%05d" ${s2%%_*})"
  t="$(printf "%05d" ${s3%%.*})"
  echo "${prefix}_xy${xy}_c${c}_t${t}.$ext"
done

Tweak it to ensure it works for you, then when ready, change the "echo"
line to:

  mv "$f" "${prefix}_xy${xy}_c${c}_t${t}.$ext"

The script I use to remember this stuff is here:
   https://github.com/ctrueden/ctr-scripts/blob/master/using.sh

Regards,
Curtis

On Fri, Dec 5, 2014 at 5:13 PM, FangfeiLi <lifangfei at hotmail.com> wrote:

> Hi Curtis,
>
> Thank you so much for your reply.
>
> Actually, the situation is a little more complicated.
>
> What I can get image by using bfconvert is like
>
> image_xy0_c0_t0.tiff (image_xy%s_c%c_t%t.tiff),….
>
> But I want to have file name like
> image_xy0000_c0_t00.tiff, i.e.,4 digits for series, 1 digit for channel,
> and two digit for time.
>
> It seems that the command following can only change one part at a time.
>
>    "for f in name*; do mv "$f" "name$(printf "%05d\n" "${f#*name}")"; done”
>
> I am not quiet familiar with the shell language.
>
> Is that possible that you give me some hint on how doing it?
>
>
> Thank you so much and best regards!
> Fangfei
>
>
>
>
>
> On Dec 5, 2014, at 1:20 PM, Curtis Rueden <ctrueden at wisc.edu> wrote:
>
> Hi Fangfei,
>
> > Unfortunately, there isn't a way to do this at the moment.
>
> In the meantime, you could simply rename the resultant files afterwards:
>
>    for f in name*; do mv "$f" "name$(printf "%05d\n" "${f#*name}")"; done
>
> Regards,
> Curtis
>
> On Fri, Dec 5, 2014 at 11:58 AM, Melissa Linkert <
> melissa at glencoesoftware.com> wrote:
>
>> Hi Fangfei,
>>
>> > I have a question. When using the bfconvert to transfer file from nd2
>> to tiff, can I save the file name like
>> > name0001
>> > name0002
>> > …
>> > name0010
>> > name0012
>> > …
>> >
>> > instead of
>> >
>> > name1
>> > name2
>> > …
>> > name10
>> > name12
>> >
>> > when using %s?
>>
>> Unfortunately, there isn't a way to do this at the moment.  However, I
>> have
>> opened a ticket on our issue tracking system for this:
>>
>> http://trac.openmicroscopy.org/ome/ticket/12678
>>
>> You will be automatically notified of updates to the ticket - just let
>> us know if you prefer not to receive updates.
>>
>> Regards,
>> -Melissa
>>
>>
>> On Thu, Dec 04, 2014 at 09:56:23PM -0500, FangfeiLi wrote:
>> > Hi,
>> > I have a question. When using the bfconvert to transfer file from nd2
>> to tiff, can I save the file name like
>> > name0001
>> > name0002
>> > …
>> > name0010
>> > name0012
>> > …
>> >
>> > instead of
>> >
>> > name1
>> > name2
>> > …
>> > name10
>> > name12
>> >
>> > when using %s?
>> >
>> > Thank you very much and best regards!
>> > Fangfei
>> > _______________________________________________
>> > ome-users mailing list
>> > ome-users at lists.openmicroscopy.org.uk
>> > http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users
>> _______________________________________________
>> ome-users mailing list
>> ome-users at lists.openmicroscopy.org.uk
>> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-users/attachments/20141205/a4c6b530/attachment.html>


More information about the ome-users mailing list